Category "entity-framework-core"

EF Core 5.0 Many-To-Many delete from nested collection

My models are like this (simplified): public class Request { public string Id { get; set; } public List<Tag> Tags { get; set; }

Could not load file or assembly 'Microsoft.Data.SqlClient' in .NET 6

I have developed a WPF app on .NET 5 (CRUD operations with Entity Framework Core). MSI packages are built with Wix toolset. Up to here everything works. I am cu

EF Core: Union vs LinqKit for dynamic linq to SQL

I was always using the LinqKit to implement dynamic and cooperative predicates. However, the last time I saw a colleague use the Union to combine dynamic querie

Unable to make raw SQL calls from Entity Framework Core

I am working on a project where I am moving specific rows from a table between multiple different environments. The table has an Identity column and when I try

Backingfield is null in EF Core 3.1 , Lazy loading enabled

I am using Lazy Loading in EF core 3.1 and when i try to get the navigation data,it doesn't load. public class Template { private readonly List<Spec>

EntityFrameworkCore Performance tuning when filter one dbcontext object using the other dbcontext object

I asked something similar recently and it got solved by using AsQueryable: How to save time when pulling data from DB using Entity Framework Core in controller

ASP.NET EF Core Database update on Mac using docker image Azure Sql Edge

I am new to mac and got Azure Sql Edge running using docker image. This is the command I ran to run the image. docker run -d --name SQLServerImg -e ACCEPT_EULA=

I was trying to implement per tenant one database using ABP framework but couldn't succeed with that approach

I was trying to implement per tenant one database using ABP framework but couldn't succeed with that approach. In the documentation, it says to configure using

The entity type 'List<string>' requires a primary key to be defined

Getting "The entity type List<string'> requires a primary key to be defined." using .NET 6 to build a Web API. The following is my Model class defining "S

Breakpoint not hit in EF Core IEntityTypeConfiguration class on add-migration in PackageManagerConsole

I am doing some discovery in a small test project and am trying to have a breakpoint hit in the configuration definition class. public class TripExpenseComparis

Create dynamic entity from nested classes to bind Devexpress net core Data Grid

I have a data transfer object like this : public class PerformanceCostDto { public int Id { get; set; } public long WorkId { get; set; } public stri

Entity Framework Core Delete Behavior

So I have these 3 tables where 2 of them(Post(Parent of Comment table as well) and Comment Table) is parent of Reaction Table. Post Table: public class Post {

EF Core - Unable to resolve service for type DbContext while attempting to activate ApplicationContext

I am attempting to scaffold CRUD razor pages using entity framework but the code generator throws the following error: There was an error running the selected

How to generate empty migration in EF Core code-first while ignoring pending changes?

I am aware that the add-migration command will generate a new migration file with empty Up() and Down() methods. However, I have an error when building which me

The corresponding CLR type for entity type cannot be instantiated Table-per-type

Using EFCore 5 I've been trying to follow Microsoft tutorials to create a field in a model class that may reference two other classes. In my case, I have an abs

Oracle sequence EF Core 6.0?

I need to get a NEXTVAL from a SEQUENCE in an Oracle database. The modelbuilder does have a builder.HasSequence("TABLE_SEQ"); But I have no clue on how to use

Using NEWID() when explicitly inserting a value for an ID (key) column mutates ID values for other previously existing rows in the same table

I have a SQL Server database which is maintain through Entity Framework Core. Every time I need a change of the database schema, I just generate a new migration

Optimistic Concurrency Exception

I have been battling with this error for a while now. I hope putting it here will help. I have attached by models and also the method call being made. The erro

Entity Framework Core - Relationship between owned child and another chained owned child

I am stuck with Problem, that I am trying to solve the right way. I have multiple one-to-many 'owning' relationships. But I have a duplicate relationship betwee

EF Core group by date and count value for previous dates

I have a table like Date Balance A Balance B --------------------------------- 2022.03.01 100 200 2022.03.01 200 500 2022.03.02 300