Category "entity-framework-core"

IQueryable extension to group dynamicly by minutes ...and other

I wanted to create an IQueryable extension to allow other developers to group entities by minutely interval but also by custom group key result. My idea was to

EF Core - generic way to merge child records based on current db state and equality

I have a scenario where during an Update request of a parent entity, I have a collection of children entities in my dto, and want to merge them in the DB so tha

Database operation expected to affect 1 row(s) but actually affected 0 row(s) entity framework core

I have the following code try { using (var context = await PrepareDatabase()) { // Update temp roles by removing one row, this

EF Core 3, optimize lots of Include/ThenInclude

I have a query like this return await _ctx.Activities .Include(a => a.Attributes) .Include(a => a.Roles) .Include(a =

.NET Core Pomelo Mysql connection

I'm trying to run a Entity Framework command in dotnet cli and I'm getting the following error: Access denied for user ''@'fe80::45b2:4add:f2de:ebcf%6' (using

The entity type 'Access' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'

i have this ValueObject : public class Access : ValueObject<Access> { public string ControllName { get; set; } public string ActionName { get;

Why won't EF Core update this item on my database?

I'm having trouble updating an item on my database. I've tried several different ways, but nothing seems to work. Here is my latest attempt: public async Task

EF Core 6 Seeding Data Gives Foreign Key error Despite Having FK Value

So, I have struggled with this for a while now and can't figure out what I'm missing. I have a table that holds an entity called Skill and the DataModel looks l

EF Core HasData Seeding a TPH Entity

I want to use the EF Core HasData method to seed a database with reference data. Two of the models I want to seed follow the Table per Hierarchy (TPH) pattern i

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