The ADO.NET Entity Framework is a set of ORM (Object-Relational-Mapping) tools for the .NET Framework, since version 3.5 SP1.

learn more… | top users | synonyms

1
vote
2answers
37 views

Database mirroring cache

I generally prefer to work with EF by specifying exactly the data to fetch from the DB with regards to Navigation Properties/Lookups and the like, so we wrote this cache system to limit the number of ...
2
votes
0answers
55 views

Generic Entity Framework Query in CQRS

I've been working on our application (CQRS and DDD) for awhile now. The application architecture is well layered and thought through. However we are having difficulties in decide where to put the ...
3
votes
0answers
44 views

Updating Related Data the MVC/EF Way

I have an ASP.NET MVC Controller, the relevant parts of which appear here: ...
9
votes
2answers
203 views

Concerns about the correctness of my Repository and Controller tests

Lately I have been researching how to best unit test an EF repository and given a properly tested repository, what to test in the controller. My research did not reveal many sound examples or ...
6
votes
2answers
95 views

Concerns about my repository implementation

I have a repository called PostsRepository: ...
1
vote
1answer
43 views

Dynamic Linq from string with EF

I wrote an EF browser to dynamically navigate through entities. Beside basic properties of system types, each entity can have several singular or plural navigation properties. In order to support all ...
1
vote
4answers
89 views

Checking if there are tags or categories in the database

The code below is used to check if there are tags or categories in the database. If they exist, they are not added to the database, otherwise they are added. Is this code efficient and easy to read? ...
2
votes
1answer
39 views

Can this method be changed to remove all objects in one call?

I am converting a VB.NET app over to C#. I won't subject you to the old code but the following is done in a little over 100 lines using nested loops. I am using Entity Framework 6 as my ORM. I have ...
3
votes
1answer
60 views

Data model for tracking currency in a safe [closed]

I am attempting to design an application that tracks currency and recent transactions in a safe. I am using entity-framework code-first in a wpf desktop application. The first goal is to be able to ...
2
votes
1answer
81 views

Is there better way to shorten this Lambda expression's result selector?

I'm new in LINQ and Lambda expression. I'm not sure is there a way to shorten the result on this o.z.cust.cust.cust.bintAccountNo. As you can see below, the more ...
10
votes
2answers
215 views

Do I need ninject when implementing DAL with generic repository and unit of work?

I am implementing generic repository and unit of work for the first time. I would be glad if someone can correct me if I am doing something wrong here. This is how I communicate with my DAL from ...
1
vote
1answer
53 views

Concept for saving context information

My Problem I have a library containing business logic which is being used from 3 different projects: Website Local WPF Application WCF Service The library uses Entity Framework and a connection ...
7
votes
4answers
423 views

Basic Entity Framework Repository implementation

Here is simple repository pattern that I use to access data in my database. I would like some advice on how to improve this code. Commenting on my code quality is also welcome too! ...
1
vote
1answer
55 views

Update multiple records with Entity Framwork

I am wondering what the best way to update multiple records with Entity Framework is. This is how I normally do it, and it does work: ...
3
votes
1answer
68 views

Entity Framework - updating two different arrays of child associations

Exercises have Muscles and Tools. When someone adds or updates an ...
9
votes
1answer
183 views

EF6-Lambda Expressions deep big-tree query

I am looking to improve the following query. We are using EF6 (CodeFirst) and C# Lambda Expressions, and Repository/Unit of Work patterns. Also, we needed to restrict the query in a way that we ...
2
votes
4answers
354 views

Silent Try_catch in high load socket server or not?

I'm working on a socket application that will listen to incoming messages from about 400 devices. They all send a message at least once per minute. Now I have a working program and it has been running ...
5
votes
1answer
58 views

EF query for calculating monthly trends

My application has a fairly important query that is used in a lot of places. Unfortunately it takes about 14 seconds to run, so I'd like to find a way of possibly improving it. The application ...
1
vote
1answer
55 views

Refactor Oracle Entity Framework lambda query

I had a ugly problem and wrote an ugly query. Query creates a cache that is used to get person id when I have {full_name, id_code?, birth_date?}. By question mark I mean that it is perfectly valid ...
5
votes
2answers
240 views

Static Data Helper for an Oracle Backend

What I would like to do is have a method call like: ...
3
votes
1answer
83 views

Method to save child objects

I'm using Entity Framework 6 with database first. See the image for the relevant database schema I have the following method to save a Set to the database: ...
0
votes
0answers
62 views

WebApi synchronize database (EF 6) access

I'm working on an ASP.Net MVC 5 /WebApi 2 project. I'm using EF 6 code first for my database access. I've a WebApi action method in which I've to update some data in my database based on the request. ...
5
votes
1answer
70 views

Work around for EF6 bug 1748 in the Entity Framework

Entity Framework 6 fails to handle the maintenance of LocalDB's global list of databases. That is noted here: Application fails when attached mdf and ldf files are deleted Here is my code to work ...
6
votes
1answer
134 views

Refactoring a LINQ query that (sometimes) returns null

I have the following LINQ query that should return a result for each Request. I'd prefer to have the query translated to ...
1
vote
1answer
164 views

Multi threading in ASP.Net to increase performance of processing data from entity framework using anonymous types

Intro I am trying to populate a Multi-column Combo-box with a large amount of records.Depending on the selection the user has taken there can be 1 - 50000 items in the Combo-box (I may not display ...
4
votes
1answer
77 views

Insert Model object effectively using entity framwork

I have a WPF MVVM Application. I have a Customer Model which is generated by an entity framework (Database first approach) and one CustomerViewModel where I ...
2
votes
1answer
103 views

BaseRepository for EF6 - updated

Previous question: BaseRepository for EF6 I've update my code. Is it correct now? I've changed IEnumerable to IQueryable. ...
8
votes
6answers
369 views

BaseRepository for EF6

Is this okay? ...
2
votes
1answer
73 views

Making the objectContext.CommandTimeout configurable?

I am trying to make the CommandTimeout value more configurable. I'm wondering if this is best practice to do so? I add the following to my <appsettings> ...
3
votes
3answers
333 views

Entity Framework with multiple connections open?

I'm learning Entity Framework and I'm wondering if this code is the proper way of doing this. Basically this is my attempt at refactoring a very long controller in ASP.Net MVC 4. I'm using Entity ...
2
votes
1answer
121 views

Seperating Entity Framework into BLL

I have an Entity Framework working with a SQL database. A Web Forms application is currently communicating directly with the Entity Framework model from code behind. I have been tasked with creating a ...
4
votes
1answer
102 views

Saving a sales order - too many repositories?

I am wondering if I have overdone it with repositories in the following code, which is to save a sales order. I understand that the purpose of a repository is to decouple the domain layer from the ...
2
votes
1answer
70 views

Compare Collection with the information in DB using EF and LINQ

I want to inform the Receivers about new contracts we have this week. After I sent the Emails, the Information about sent contracts are stored in MS SQL Database. To avoid that someone become the ...
4
votes
1answer
162 views

EntityFramework-based filtering

I am trying to use the following form to enter new info into a database. I am trying to use the entity framework. I have the following classes of Interest: ...
2
votes
1answer
184 views

Parent/child relationships: adding/updating details to an answer

Answer is the Parent table and AnswerDetail is the child. Below works, but I'm wondering if there is a better way to do this using EF? My Method Signature is this: ...
5
votes
2answers
198 views

Getting list of daily team goals

The old code I had before was atrociously slow but after some advice and research I was able to take a 2-5 minutes run time down to about 5-30 seconds. That is acceptable, but still looking to have ...
5
votes
3answers
194 views

Calculating total sales from each member

I am building a new system that is using some tables from an old system. For each user on this new system, I need to go to the old system and total up their sales. Currently it takes between 2-5 ...
4
votes
1answer
105 views

Am I even using the Entity Frameowrk and/or LINQ the way it is supposed to be used?

I feel like just because the below works doesn't mean it is correct, I want to improve it but I can't really figure out how. Besides the fact it is down right ugly I feel the performance could be ...
7
votes
2answers
2k views

Unit of Work and Repository with Entity Framework 6

Based on the reply of this question I have created the following code. I need to check whether it's good or not. Here is my entity class: ...
4
votes
1answer
715 views

Database first entity framework, repository, service, UnitOfWork pattern

I have seperated my project into two projects. One is the web forms project and the other is the Model project with contains a generic repository implementation, a service class for each of my ...
2
votes
2answers
90 views

Add chat to an MVC database: Can I condense this code and is it appropriately placed?

I have these relevant tables in an MVC website: Server ServerPlayer ServerPlayerChat Servers have serverPlayers, ServerPlayers have ServerPlayerChats. Simple enough and expectable. I'm using ...
1
vote
1answer
73 views

Group By And Two Counts

I'd like to know if there's any better way to write this query: ...
4
votes
2answers
88 views

Retrieve Tasks by Employee

I think I've done a decent job keeping this query simple and understandable, but I'd like to know if you have some more advice. My relevant entities are defined like this: ...
7
votes
1answer
687 views

MVC 5 & EF 6 - Repository & Unit of Work Pattern

I have been looking through Code Review on the subject of Unit of Work and Repository patterns and realised that my implementation appears to provide very similar functionality but in reverse class ...
4
votes
1answer
151 views

Using static management class to control db transactions through an EF6

I have the class below to manage my specific implementation of a membership system using entity framework 6.1 Is the use of static access correct in this case? as far as I understood that EF context ...
5
votes
2answers
386 views

Entity Framework Skip and Take too slow

The following code achieves what I require, reading 10000 rows at a time: var query = repository.Subscribers.ToList().Skip(numberToSkip).Take(numberInBatch); Is ...
5
votes
1answer
432 views

Model Design for MVC4 Applications using Entity Framework Code First

I would like to put the following design to your consideration. This is the pattern I use to follow when I'm building a Model and Data Access Layer for an MVC Application (using Entity Framework 5). ...
3
votes
1answer
144 views

Implementing the Repository Pattern

I'm new to this pattern and I see arguments online about different implementations. I have the following code and it seems fine to me, but I'm wondering if having to pass the DBContext into the ...
4
votes
1answer
195 views

Verifying the Entity Data Model schema against a production database

We have an entity data model (database first) for a legacy product we are migrating to .Net from Delphi. We recently deployed to a server where some of the tables had been modified and columns ...
1
vote
1answer
91 views

Class to Return Single Integer

I have a class used to return a single integer, but think there is room for improvement. The class should only return a single row every time and if no row is found it might be a good idea to throw an ...