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.
397 questions
1
vote
1
answer
65
views
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 ...
1
vote
2
answers
178
views
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 ...
1
vote
1
answer
362
views
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 ...
1
vote
2
answers
176
views
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 ...
1
vote
1
answer
8k
views
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 ...
1
vote
1
answer
200
views
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 ...
1
vote
2
answers
134
views
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 ...
1
vote
1
answer
112
views
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 ...
0
votes
1
answer
2k
views
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 ...
3
votes
1
answer
1k
views
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 ...
4
votes
0
answers
162
views
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 ...
2
votes
1
answer
127
views
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 ...
2
votes
1
answer
1k
views
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 ...
4
votes
2
answers
746
views
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:
...
1
vote
1
answer
137
views
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 ...