Category "entity-framework-core"

Blazor wait for ef core to finish request

So right now I get a Error: System.InvalidOperationException: A second operation was started on this context before a previous operation completed. Because bla

Cannot create database migration on EF Core but It can when you ask to EnsureCreate database

I am trying to inject some repository to a service and some services to a controller but I am using the DbContext is an assembly that is not the startup projec

Cannot create database migration on EF Core but It can when you ask to EnsureCreate database

I am trying to inject some repository to a service and some services to a controller but I am using the DbContext is an assembly that is not the startup projec

How do I solve SqlNullValueException?

I'm trying to find an entity but I get a SqlNullValueException when entity framework is trying to get the value of a field that's Null. I checked in the databa

Unable to resolve service for type 'Microsoft.EntityFrameworkCore.Storage.TypeMappingSourceDependencies'

When I'm trying Add-Migration, following error was occurred. I'm using, <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <

.Net Core Oracle Connection time out

we have application .net core with oracle database published since 8 months unexpectedly returned request connection time and we didn't make any deployment and

How do I mock AddAsync?

I'm writing unit test. For testing the method below, public async Task<Guid> CreateWebJobStatus(string blobId, Guid loggedInUserId, string loggedInUserE

Best practice to handle concurrency in EF Core and ASP.NET Core?

Currently I'm doing the following when inserting/updating and entity: public async Task<IdentityResult> UpdateAsync(Model model, CancellationToken ct = de

Use client side function in QueryFilter

I used a List.Contains method in a query filter in Ef Core 2.2.1. Since the version 3.0, I have the message "query filter cannot be translated" because we have

Including One Subitem From A List property while Making use of ThenInclude()

I have a function that's purpose is to pull an auction by its id from the data base and include it's highest bid and the highest bid's type. I was able to get t

Get navigation properties in Entity Framework Core

In EF6, this method works to retrieve an entity's navigation properties: private List<PropertyInfo> GetNavigationProperties<T>(DbContext context) w

Does not contain definition for "HasDefaultValue"

I want to set a default value for a non nullable field in code first. I have included Microsoft.EntityFrameworkCore but I'm still getting Does not contain

Microsoft.EntityFrameworkCore.Internal.DiagnosticsLogger`1'

I m trying to migrate my data base using EF core when i run this commande "dotnet ef migrations add Init --context PersistedGrantDbContext -o Migrations/Persis

Entity Framework Core too slow on First call

I have around 40 entities and everytime after I compile and run my app it takes almost 10 seconds whenever DbContext is called for the first time. Is there a wa

Entity Framework Core 5 and CosmosDB SQL API - Include extension method does not work

I have followed the steps from the following EF Core 5 site in order to store and read items from the CosmosDB. Here is the site: https://www.learnentityframewo

EFCore join values

I'm trying to join a big table to a small list of data pairs using EFCore 2.1.1. I want this join to happen server-side, rather than trying to download the who

Storing DateTimeOffset value without milliseconds in SQL Server using EF Core

Say I create a DateTimeOffset value like this: var dt = DateTimeOffset.UtcNow; And I want to store this value in SQL Server using EF Core code-first. How do I

Intercept saving of entities in Entity Framework Core

Is there a way for EF Core to intercept the pre insertion, pre update, pre delete, post insert, post update and post delete events of an entity? EF core support

Check if todays date exists in a table with Entity Framework

I have a database table with columns of type dateTime. Now I need to see if there already is a row with today's date, but I don't know how to compare the column

Entity Framework CORE Seeding Joining table

I am working on .NET CORE 6 along with EF CORE 7. I need to seed data in joining table but unable to do so and get error. I am seed FileTypeId but not sure why