Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [entity-framework-core]

Entity Framework (EF) Core is a lightweight, extensible, and cross-platform version of the popular Entity Framework data access technology.

Filter by
Sorted by
Tagged with
5 votes
2 answers
270 views

I have this code which I am upgrading to .NET 8. The intention is to sort and filter the resultset using the parameters. Right now it has a lot of if else and redundant code inside the blocks. I would ...
codeandcloud's user avatar
3 votes
1 answer
889 views

I have a table representing a class hierarchy using the TPH model. Some of those sub classes have navigation properties (collections and/or references). I'm trying to preload them as I know I will ...
Irwene's user avatar
  • 195
2 votes
0 answers
48 views

I'm playing around with an app that will need to read Hierarchy trees quickly but will seldom modify them once created. I've chosen to use HierarchyIds with Entity Framework to model the hierarchy. I ...
Luke's user avatar
  • 21
0 votes
1 answer
624 views

I am not sure of the correct way to do this. I want to separate my Entity database model from the model I use throughout my application, as it will have fields in it that I may not want added to the ...
Scottish Smile's user avatar
2 votes
0 answers
4k views

I'm trying to "optimize" the command below. In other words, to make it suit my needs using best practices. I found a lot of posts regarding the "upsert" operation and there were a ...
nop's user avatar
  • 819
0 votes
1 answer
91 views

Let's say you have a book. A book can have an author, an editor, a proof reader, or several other credits. Which credits are available should be dynamic (someone might not want to have the "proof ...
TheHvidsten's user avatar
2 votes
1 answer
2k views

I am building a .Net Core 6.0 application that uses Entity Framework. I have situation where I need to apply the filter(Where clause) based on two properties (eg: Guid? skillType, string skillName). ...
One Developer's user avatar
1 vote
1 answer
2k views

I have the SQL Products table migrated from MongoDb and I use ASP Core + MediatR. The filtering data comes from frontend ...
user2771704's user avatar
-1 votes
2 answers
158 views

I would like to share this post with the community since at first glance it is very promising. Storing flags in the database is something that I have been interested in doing for a while since it ...
jwize's user avatar
  • 199
3 votes
2 answers
233 views

Is there a way to make the following code more maintainable? ...
Kirsten's user avatar
  • 443
3 votes
1 answer
371 views

I created a SqlMonitorInterceptor that will check the execution time of queries and log errors. The main idea is to log queries in such a way that they can be easily copied into SQL Server Management ...
sDima's user avatar
  • 889
4 votes
2 answers
148 views

I have a few lines where I am trying to get a list of the 25 most popular Items sold on an E-Commerce web site. The code works but I would like hints on how to optimize it. ...
Randy's user avatar
  • 527
1 vote
2 answers
163 views

I have a Item Service that is Called from an Asp.Net Core API Controller. The query gets all items in a particular category for display on an eCommerce web site (reactjs). The controller only returns ...
Randy's user avatar
  • 527
1 vote
2 answers
760 views

I am working with C#, Npgsql, EF Core and Postgres. I ...
Emaborsa's user avatar
  • 193
0 votes
1 answer
158 views

UPDATED I have a POCO class that is populated with _context.Categories.Load(): ...
Randy's user avatar
  • 527
-3 votes
1 answer
290 views

I tried to create a .Net core API using Microsoft Documentation but I ran into some issues. The app is working but only for a "single" table. The includes are empty. ...
AnthonyDa's user avatar
1 vote
2 answers
191 views

I have the following method that I am trying to optimize. Currently, the method works great, however, it takes a little over 3 hours to complete. I feel like, using some nifty LINQ joins, it should be ...
Icemanind's user avatar
  • 188
4 votes
1 answer
7k views

As you might know, EF Core does not support executing multiple queries in parallel on the same context using something like Task.WhenAll. So you have to write this ...
wertzui's user avatar
  • 188
3 votes
2 answers
2k views

I am using ASP.NET Core 3.1 and have been assigned a task to verify the count of changes done using SaveChanges(). It is expected that the developer should know how ...
prinkpan's user avatar
  • 201
2 votes
1 answer
1k views

I'm porting my site over from .NET Framework / MVC 5 / EF6 to .NET Core 3.1 MVC / EF Core. MSSQL Server for the database. EF6 has SqlFunctions of which one method ...
suraj's user avatar
  • 33
1 vote
1 answer
137 views

I've implemented Many-To-Many relationship and wonder if this is the optimal way for it. Since I do not have extensive EF Core experience I would love if someone with more experience could check it ...
sed's user avatar
  • 175
7 votes
2 answers
4k views

So, I have an ASP.NET Core 3.1 web site that makes occasional calls to a vendor's RESTful API. I use the HttpClient class to perform these calls. Currently, the ...
EJoshuaS - Stand with Ukraine's user avatar
1 vote
1 answer
991 views

I'm very new to Entity Framework Core, so I'm concerned about whether I've done this query in the most efficient way possible. The database I'm querying looks like this: Basically, ...
EJoshuaS - Stand with Ukraine's user avatar
5 votes
2 answers
187 views

I have the following relationship in EF Core 3.1.1 (Many-To-Many): ...
Igor's user avatar
  • 192
1 vote
1 answer
1k views

I am creating a simple model relation in ASP.Net core. My model relations are like this: A user can have many posts A post can have many comments A user can have many comments Now I am trying to seed ...
Bikram's user avatar
  • 113
5 votes
1 answer
217 views

The task of the code that is presented for review is to prepare all the data for the export of the selected contract and create a file on this basis. This is one of the first experiences with a ...
Viewed's user avatar
  • 304
3 votes
1 answer
527 views

This is a follow-up on bank ATM mockup app in .NET Core framework and Entity Framework Core. I have 2 user interfaces: Console and Web. Previously I have UOW and repository layer but I have removed ...
Steve Ngai's user avatar
6 votes
2 answers
328 views

I am working on an iban api which is about saving the iban of some members after (iban validation) in a database. The code is split between Domain (entities, behaviour for iban validation), Database ...
Natalie Perret's user avatar
9 votes
1 answer
30k views

In Entity Framework Core we can have recursive entities. But we cannot do an "Include" for these recursives (can we?). So I wrote a Get-method that does it for me: ...
Matthias Burger's user avatar
2 votes
0 answers
86 views

I am using Entity Framework Core as ORM in my ASP.NET Core 2.1 project. I want to perform server-side pagination in Career Controller for getting list of careers. I have a model which looks like: <...
Dot Net developer's user avatar
7 votes
1 answer
353 views

Business logic It would take us too far to explain the whole business case behind this code, so I'll try to be as succinct as possible. There are Persons, and ...
BCdotWEB's user avatar
  • 11.4k
-1 votes
1 answer
173 views

I know the difference between the Entity Framework connected mode vs disconnected mode. In connected mode we do all the stuff inside one single DbContext instance. ...
Ahmed Suror's user avatar
4 votes
3 answers
322 views

Nowadays I am learning Domain Driven Design intensively. I am reading the book called Domain Driven Design by Eric Evans, and at the same time I try to apply the knowledge on a real life project I ...
mirind4's user avatar
  • 309
8 votes
1 answer
230 views

The following is a class in the service layer of an ASP.NET Core web application, which currently contains a single method: PurchaseCart. The intention is that an ID is passed in to a "shopping cart" ...
BinarySolo's user avatar
0 votes
2 answers
4k views

I was reading about anemic data models and rich domain models in DDD. I don't want to follow DDD completely but take rather pragmatic approach and just take some concepts out of it because clean ddd ...
Konrad's user avatar
  • 227
7 votes
1 answer
5k views

I have a rest service on Azure AD that calls other rest services. They use AzureAd authentication and AuthContext with a custom TokenCache that stores each users ...
Justin Dearing's user avatar
4 votes
1 answer
4k views

I am trying to create a data model where there are Document entities, which need to be in a defined order to each other. Think of an article that has sections which ...
Sebastian Krogull's user avatar
2 votes
1 answer
1k views

I have never created a web service before. I followed most of this Pluralsight tutorial to give me an idea of how to create one using ASP.NET MVC along with .NET Core 2.0 and Entity Framework Core. ...
Window's user avatar
  • 123
1 vote
1 answer
1k views

The below code works but there's a lot of duplication I wonder if I can get around. I would like to be able to use .AddDeveloperSigningCredential(false) if in ...
egmfrs's user avatar
  • 185
3 votes
1 answer
10k views

Me colleague and I recently had a discussion on good practices in EF. So I showed one of mine. He said it is a little bit muddler. My practice consists of modifying the autogenerated class in a ...
Met's user avatar
  • 33
2 votes
0 answers
2k views

This is my model: ...
Glyn's user avatar
  • 121
1 vote
1 answer
1k views

The code is returning reviews based on users like status order. It seems it executes a lot of SQL queries, so do you think it can be simplified and can it be a headache to server performance? ...
Okan Aslankan's user avatar
1 vote
0 answers
958 views

I want to create some BaseRepository for EntityFrameworkCode and I've tried construct this Repository based on code from ...
Jenan's user avatar
  • 111
4 votes
1 answer
1k views

Our database has several tables that have a value that can be one of 4 things, so we made these columns instead have an id column with a foreign key to an enum table with an id and a value column to ...
Austin_Anderson's user avatar
2 votes
1 answer
355 views

I am building my UWP app and really stuck in the architecture. For the past few days, I have been reading MVVM, Entity Framework, SQLite, Code First, etc and I am confused how I will implement ...
Gibs's user avatar
  • 123