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
17 views
Unit Of Work and locking construct, EF and ASP.NET webforms [on hold]
I am working on an existing ASP.NET web application that uses the repository pattern and EF. In some cases, I noticed errors when saving because of for e.g. taking max value from database for code ...
1
vote
1answer
41 views
Table join using the repository pattern
I am new to repository pattern. If I want to join two tables, where should I implement the logic? I have implemented it as shown below. Is there any better way to achieve the same?
This is my ...
2
votes
0answers
32 views
DataDictionary Application - Controller
This is related to DataDictionary Application - Model
I haven't done much on the controllers yet, as it's the first time I've written Controller-type classes and wanted some quick feedback on really ...
2
votes
1answer
45 views
DataDictionary Application - Model
Following on from my previous question, I think my Entity Framework model code is now complete. First I'll provide a quick overview of the program - everything above the next horizontal rule can be ...
2
votes
1answer
58 views
MVC Repository Insert Using async
This is practically my first time using async in my code. I read about dos-and-donts but I wanted to get some feedback on what I've written.
I'm using a repository ...
1
vote
1answer
31 views
Converting table data into nested JSON
I'm new to C# (coming from a JavaScript background) and it seems like this code could be greatly improved.
This SQL query:
...
2
votes
1answer
51 views
Organising structurally very similar classes
A little background - these are classes I've written on top of an Entity Framework model that represents tables on Sql Server with the following names:
...
0
votes
1answer
62 views
Awkward Generic Repository Call [closed]
I am implementing a generic repository pattern. I have done this quite a few times now but every time I do it there is something bugging me.
If I have a database design like below. (All the tables ...
4
votes
2answers
125 views
Two functions to impose order on queries
I am writing a c# program to build generic sort algorithm on a request to a collection of data. The data needs to be sorted based on the supplied columns.I am using Entity framework and Expression ...
6
votes
2answers
216 views
1
vote
0answers
80 views
Retrieving Primary Key from Entity Framework entity
Entity Framework (version 6) generates classes based on your tables that look like this (where each property represents a field in the table):
...
1
vote
0answers
32 views
Query against history table
I have this linq query that queries a table that retains any change history done to any of the tables is constructed like this:
...
1
vote
0answers
79 views
Logic for changing entity navigational properties States
The question might seem a little bit long, but I will be very glad if you have read it till the end and told me your opinions.
Let's say I have such entity:
...
1
vote
2answers
106 views
Code separation in MVC
Firstly I am not a professional programmer and I am just learning C#, MVC and Web Development.
Much of what I describe here is self taught and comes from lots of googling and posts on Stack Overflow. ...
3
votes
1answer
72 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:
...
2
votes
1answer
52 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
3answers
81 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
61 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 ...
4
votes
1answer
142 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 ...
2
votes
2answers
86 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
53 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.
...
1
vote
1answer
76 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
217 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 ...
3
votes
1answer
123 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
117 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
547 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
684 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
188 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
51 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
125 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
175 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 :
...
-2
votes
1answer
76 views
Reducing database access time and connection count [closed]
I have 2 connections. How can I reduce this to one connection?
...
0
votes
1answer
90 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
117 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
117 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
453 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
777 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
83 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
295 views
3
votes
1answer
46 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
2k 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
268 views
2
votes
2answers
181 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
192 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
194 views
Splitting code into separate methods and avoiding the Unit Of Work / Repository pattern
Take a look a this service method:
...
3
votes
1answer
76 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
83 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
159 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
322 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
120 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 ...