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

3
votes
1answer
47 views

Is it okay for my query handlers to use other query handlers?

I recently started looking into CQRS when using Entity Framework and the impact it has had on my systems has been overwhelming. I implemented the following patterns described in these blog posts: ...
1
vote
0answers
25 views

Query the context or resulting list

I was just getting some products using entity framework and was wondering which would be better to do when getting the results or if there is no difference Option 1 - Query the context directly ...
1
vote
1answer
25 views

Dealing with DB Through EF within Winforms

I have the following code which uses EntityFramework to reach out to a DB and retrieve data to populate into a Winform application gridview. I am still quite new ...
1
vote
0answers
36 views

Replacing IUnitOfWork with a Factory Pattern

As a follow-up to this blog post and this question, I wanted to post my idea of replacing the IUnitOfWork with a factory pattern. It seems to me that in the case of this blog post the IUnitOfWork ...
3
votes
1answer
59 views

Web API using Repository / UnitOfWork

I'm looking for feedback on a repository I set up based on a blog post I read here. I have just recently got more into .NET within the past year, so any feedback and/or best practices that can be ...
1
vote
2answers
37 views

MVC4 Unit Of Work with Entity FrameWork

I am designing a new asp.net MVC4 application. I know that context class generated by EF is Unit of work and Dbset is the repository class. I am just avoiding the extra abstraction. I want to know ...
1
vote
1answer
35 views

Exposing includes to client over webservice for database queries

I am using a CQRS type patter for querying data in my application. I am currently using entity framework to connect to the database. ...
0
votes
0answers
26 views

LINQ to Entities query of tests for my classes, with many subqueries

This MVC4 controller method, which uses EF6, is taking a long time to run (over 2 seconds). I've added verbose comments for the purpose of this post only. ...
2
votes
1answer
101 views

Adding data to the DB in EF without using navigation properties

Questions: Is there a better way other than assigning IDs manually and creating separate lists for each model the way I have? (for this particular scenario). If so, how? (Still taking the conditions ...
2
votes
0answers
74 views

Improving LINQ expression with inner method call and switch statement

I have the following class which returns an expression that then returns data. It seems a tad over complicated and I'm pretty sure LINQ has something to offer that makes my life much easier. But I ...
5
votes
2answers
107 views

Using Linq syntax, how can I remove the select n+1 issue in this method?

I have the following code in a validation module. It works the way I want it to, but it has an obvious select n+1 problem. I would like to refactor this code to make a single call to the db to perform ...
2
votes
1answer
226 views

Automating CRUD using Repository Pattern, Web API and TypeScript

I would like a review of the following application, esp with how I'm registering and selecting the controllers. First I defined a generic Repository interface and implementation using EF 6.1.2: ...
2
votes
1answer
224 views

Calling Stored Procedure “insert query” using EF 6, UOW, and MVC 5

I'm a beginner in MVC programming, repository, and UOW using Entity framework. I tried to calling my existing SP in my MVC project using UOW and EF. Here is my code to mapping my SP in myDbContext ...
2
votes
1answer
75 views

Creating users with different roles using .Net Identity 2.0 within Entity Framework

I am using .Net Identity 2.0 with Entity Framework 6.0. I have a Person class inheriting IdentityUser. I have a ...
3
votes
2answers
49 views

Eager load additional data about some instructors

Below is a snippet of code of a little practice project. I am still pretty new to EF and I was wondering if there is a way to write the below statement so that all required data is eager loaded since ...
3
votes
1answer
93 views

Optimizing a Query in Entity Framework

I'm wondering what can be done to optimize the following. I've tried to note the points at which most of the overhead is occurring. The main two points I see are The call to DiffDays from within ...
1
vote
1answer
94 views

Asynchronous method and collection binding

I have a WPF application, in which I'd like to bind a collection to a combobox using an asynchronous method : ...
-1
votes
1answer
64 views

Reducing database access time and connection count [closed]

I have 2 connections. How can I reduce this to one connection? ...
0
votes
1answer
60 views

EF Code First Seed Method for States/Countries Part I

I am working to complete this even further, but here's what I've got thus far... (See my other post for the definition.) ...
1
vote
2answers
81 views

EF Code First Identity/Info Storage

I've built this EF for storing data for web scraping. Any ideas? What am I missing? ...
2
votes
1answer
107 views

Single Responsibility + Entity Framework

I still feel like I struggle to grasp some concepts of SOLID principles at times, and am hoping for some clarification here. The following classes are entities in an Entity Framework project. ...
4
votes
2answers
229 views

Query results with many to many and some parameters using Entity Framework in a more efficiënt way

I've created a working query in Entity Framework and I'm curious if there's a better way to do this. Since there's a lot of field on my models, I will only publish the relevant ones here. My Models ...
4
votes
2answers
253 views

Class to DataTable or Datatable to class mapper

My code goes from a class to DataTable, and back again. It populates the class's public properties, or creates DataColumns whose ...
3
votes
1answer
60 views

Handling CRUD for look-up tables

I'm creating the admin portion of a project. Specifically, I am wanting to allow the users to update the look-up tables for their areas of interest. All of my look-up tables have the same structure: ...
5
votes
2answers
175 views

EF GroupBy query optimization

I have this method: ...
3
votes
1answer
39 views

Bottleneck encountered returning records for my grid

I am using MVC 4.0/C#/EF4.0 and I have a grid page that grabs results that are filtered, sorted and paged. It's filtering results from a table that has 45,000 records. How do I improve performance? ...
5
votes
2answers
1k views

Unit of work Repository pattern DBcontext EF-Entities and ninject

I am totally confused while implementing Repository pattern with unit of work and Entity framework because I have seen tons of examples. Please suggest whether I am on the right track or not. ...
3
votes
1answer
179 views

Asynchronous task and close sql connection

The following code compiles correctly: ...
2
votes
2answers
172 views

Returning latest database ID

I want my method to use a finally block so I can be ure that my EF entity is disposed after usage, even if an exception is thrown, but I would also like to not ...
4
votes
3answers
167 views

Generic repository pattern

Please have a through look my custom implementation of generic repository pattern and suggest anything I may be lacking. I am using a generic interface with 6 methods I'll be using a repository ...
5
votes
1answer
165 views

Splitting code into separate methods and avoiding the Unit Of Work / Repository pattern

Take a look a this service method: ...
3
votes
1answer
65 views

Parent with N-Childs where each child can have N-Childs

I know my question sounds strange but I have a situation in which I have Parent Data which can have 'N' Childs and each child can further have N-Childs and so on. So its Like. Parent a. Child ...
3
votes
3answers
73 views

Account inactivity reminder

I wanted to know if this is the best approach for the Single Responsibility Principle. The responsibility of this class is to remind users whose accounts are about to expire due to inactivity. On ...
2
votes
0answers
134 views

WPF Binding to a Repository with Entity-Framework

I have an MVVM WPF application that will make use (hopefully) with a repository and ...
0
votes
2answers
190 views

Safe DbContext Disposal

I have a service class called ClientService, the service class is called using an interface IClientService. The service class ...
6
votes
1answer
110 views

Supporting Enum in EF 5 with .Net 4.0

I'm currently working through Getting Started with EF5 using MVC 4 in Visual Studio 2010 (.NET 4.0) to learn about how to use ASP.NET and Entity Framework. During the beginning of the tutorial I ran ...
3
votes
1answer
325 views

Insert missing records in a list with LINQ

We have a table with periods, and other child tables with these periods and values for combinations of product + location. Based on selected periods, I would like to add any missing rows in the child ...
5
votes
2answers
757 views

EF6 Code First unit of work pattern with IoC/DI

I'm trying to implement the unit of work pattern with dependency injection / inversion of control and entity framework version 6.1.1 Code First, in an asp.net-mvc project. ...
2
votes
1answer
361 views

ComponentManager - Entity-Component-System architecture in C++

Lately I've been working on a small C++ Entity-Component-System framework. Like most other ECS frameworks the internal data is presented as a table where an entity is a simple row index and each ...
25
votes
2answers
703 views

KISS my… unit of work

I've seen many, many UoW+Repository implementations. Whenever one was built on top of Entity Framework, I'd cringe at the added complexity. Sure the complexity buys you (sometimes) full decoupling ...
3
votes
1answer
92 views

Find the number of Colleges offering Combinations of Levels: Performance

I have been using entity framework 5 as DataAccess layer for my application. I have a case where there are a set of Levels offered. And I have a set of ...
2
votes
2answers
118 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
369 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
1answer
484 views

Updating Related Data the MVC/EF Way

I have an ASP.NET MVC Controller, the relevant parts of which appear here: ...
11
votes
2answers
263 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
126 views

Concerns about my repository implementation

I have a repository called PostsRepository: ...
1
vote
1answer
1k 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
98 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
75 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
91 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 ...