The ADO.NET Entity Framework is a set of ORM (Object-Relational-Mapping) tools for the .NET Framework, since version 3.5 SP1.
2
votes
0answers
12 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 ...
0
votes
0answers
23 views
Build a collection of CLR object using linq Dictionary<string,List<string,string>> [on hold]
I'm building a WCF service to retrieve a list of "AttributeName,AttributeGroup,AttributeValue"
For example,
...
5
votes
2answers
96 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
67 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
63 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
42 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
46 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 ...
2
votes
0answers
61 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
66 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
55 views
Reducing database access time and connection count [closed]
I have 2 connections. How can I reduce this to one connection?
...
0
votes
1answer
52 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
62 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
101 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
151 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
152 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
46 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
133 views
3
votes
1answer
38 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
869 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
126 views
2
votes
2answers
162 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 ...
3
votes
3answers
146 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
144 views
Splitting code into separate methods and avoiding the Unit Of Work / Repository pattern
Take a look a this service method:
...
3
votes
1answer
55 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
71 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
109 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
115 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
82 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
219 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
609 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
288 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
643 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
112 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
322 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
365 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
257 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
122 views
1
vote
1answer
811 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
67 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
85 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
288 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
2k 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
137 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
530 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!
...
2
votes
2answers
3k 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
175 views
Entity Framework - updating two different arrays of child associations
Exercises have Muscles and Tools. When someone adds or updates an ...
10
votes
1answer
560 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
434 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 ...