Questions tagged [entity-framework]
The ADO.NET Entity Framework is a set of ORM (Object-Relational-Mapping) tools for the .NET Framework, since version 3.5 SP1.
396 questions
1vote
1answer
42views
Map domain entities using AutoMapper.ProjectTo and clean architecture approach
We have a mid-size project. Two projects in solution, API and Domain. Domain contains services with business logic. We don't use repositories. Just call DbContext directly from services (that's fine ...
0votes
2answers
154views
EF save method that has three conditions
I created this save method that has two conditions. One condition is checking if coordinatorsId is not 0 and another one is ...
1vote
1answer
328views
Concurrent Requests Handling in ASP.NET Web API 2
I was having concurrency issues with my ASP.NET Web API 2 project with .NET Framework 4.6.2. (EF 6), although it has been live on production that has been running for more than 1 year, this problem ...
1vote
2answers
142views
EF 6.0.0.0 include linked table delete with reordering of data
I have this ef 6 delete method where I build <List> the related entities that will need to be deleted. Then I use ...
1vote
1answer
8kviews
How to optimize for loop with nested foreach
I want to optimize this code of generate pdf file with many nested loops, what makes it slow that i have for loop with 20 items ...
1vote
1answer
167views
Entity Framework - component shop using polymorphism and generic repository
I am creating a .NET Framework MVC EF application for PC components. I wanted to make full use of inheritance, polymorphism and generic repository pattern - but was wondering if my initial design ...
1vote
2answers
102views
Efficiency of finding one database record using two ID's
I'm using C#, .NET Core and the entity framework and am currently working on optimizing various functions for better performance. One of the main functions is getting a calculation based on two ...
1vote
1answer
93views
Copy vehicle information from JSON list to relational database
I am looking for suggestion to make my for loop iterate faster. With about 2000 rows of data. Below code is taking lot of time to run. So far I have followed various Stack Overflow answers. For ...
0votes
1answer
2kviews
Making a generic web API controller when using multiple tables with similar fields
I have been trying to refactor my code since I found I've been doing a lot of copying and pasting to implement the logic of the web API controllers. Here's how the controllers looked like before ...
2votes
1answer
1kviews
Parsing large text files into database
I'm a new self taught "programmer" that has been given the task at my job to parse through generated .txt test records and insert the data into a database. Usually when given a task like ...
4votes
0answers
146views
Repository pattern method implementation with entity framework and C#
I have two entities in my database: Employee and Shift. I want to implement a C# repository pattern method, that given two ...
2votes
1answer
117views
View model using different datetime component
Any advice on how to make this code; cleaner, more effective, just overall better! Program setup object that is coming from the database EF. It then maps the object to a view model and converts ...
2votes
1answer
1kviews
Entity Framework Core DbFunction for square root
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 ...
4votes
2answers
735views
pagination in entity framework and refactoring
I have an api end point which returns the paginated result, the corresponding code for that is as below: ...
1vote
1answer
120views
Many to Many Relationship using EF Core
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 ...