Tagged Questions

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
0answers
26 views

Asynchronous task and close sql connection

The following code compiles correctly: ...
2
votes
2answers
149 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 ...
2
votes
0answers
44 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
101 views
3
votes
1answer
39 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
60 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 ...
1
vote
0answers
39 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
42 views

Safe DbContext Disposal

I have a service class called ClientService, the service class is called using an interface IClientService. The service class ...
2
votes
0answers
59 views

Supporting Enum in EF 5 with .Net 4.0 (Visual Studio 2010)

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
69 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 ...
4
votes
2answers
201 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
143 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 ...
22
votes
2answers
448 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
90 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
75 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
161 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
131 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
237 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
113 views

Concerns about my repository implementation

I have a repository called PostsRepository: ...
1
vote
1answer
202 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
95 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
46 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
73 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
153 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
700 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
94 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
479 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
831 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
116 views

Entity Framework - updating two different arrays of child associations

Exercises have Muscles and Tools. When someone adds or updates an ...
10
votes
1answer
312 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
397 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
66 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
121 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
310 views

Static Data Helper for an Oracle Backend

What I would like to do is have a method call like: ...
3
votes
1answer
110 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: ...
1
vote
0answers
118 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
94 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
198 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
368 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
118 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
140 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
424 views

BaseRepository for EF6

Is this okay? ...
2
votes
1answer
141 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
724 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
154 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
120 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
79 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
278 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
869 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
215 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 ...