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

Personal messages structure [on hold]

This is the PM markup: The left bar is the list of users (with whom you started the conversation) and the right bar is the PM feed. User Entity: ...
0
votes
0answers
76 views

Generic method to pass lambda expressions performed on DTO's to Entity Framework

The following are generic methods that I use to perform lambda queries on DTO objects. The main method applies the expression to entities and returns DTO objects mapped from the entities (entities ...
1
vote
0answers
56 views

Publishing and removing database tables

I have a switch statement that works just fine, however, it has a lot of duplicate logic within it. I have an enum that my controllers use to say which is making the publish request, so ...
1
vote
1answer
56 views

Listing users in Azure Active Directory

The code below is the Index Action from a User Controllers. Basically this code returns a list of users from Azure Active Directory using Azure Authentication Library (ADAL). However I need to show ...
2
votes
1answer
30 views

Cross-Database Query Without Casting to List

I am trying to do a cross-database query without having to enumerate the variable t. ...
1
vote
1answer
44 views

Cross-cutting delete flag in a repository

I want to have a cross-cutting delete flag in my repository. I have the following repository pattern at the moment: ...
0
votes
0answers
45 views

Optimizing LINQ routines

I run a build system. Datawise the simplified description would be that I have Configurations and each config has 0..n Builds. Now builds produce artifacts and some of these are stored on server. ...
2
votes
2answers
88 views

Delayed Include rules for EntityTypeConfiguration using LINQ expressions

The aim of this class is to set rules for including navigational properties on Configuration level and then apply where needed in the code. I've decided to store expressions in the list for different ...
5
votes
4answers
163 views

Generic Repository For Web Apps

I was developing a web app using Entity Framework 6 and MVC 5. For the data access layer, I eased the job and wrote a generic repository as following: ...
2
votes
1answer
63 views

Thread-safe database updates

I have the following method that will return VariantID for given VariantName ("Name" in db). To avoid calling my db few thousand times I have dumped all records (~30) to the simple dictionary. I'm ...
3
votes
2answers
83 views

Linq to entities query for donor registrations [closed]

I'm using Linq-to-Entities for querying, and MVC.NET and C# for coding. I'm trying to generate monthly donor registry report which needs donor count, donors who signed through web,donors who ...
2
votes
1answer
94 views

Returning IQueryable<T> from my repository in Repository pattern design pattern

I am developing an application based on Repository design pattern. What should be the return type from the Repository? This is my UserRepository class: ...
1
vote
1answer
99 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
36 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
57 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
107 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
52 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
54 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
67 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
138 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
241 views

EF lookups and enums

I have a lookup table "RequestTypes" that has the following data: ...
1
vote
0answers
243 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
35 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: ...
2
votes
1answer
97 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
114 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. ...
6
votes
1answer
121 views

Allowing 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
59 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
123 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
77 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 ...
5
votes
2answers
208 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
103 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
54 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
87 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
371 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
191 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
132 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
915 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
1k 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
283 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
57 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
160 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
260 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
82 views

Reducing database access time and connection count [closed]

I have 2 connections. How can I reduce this to one connection? ...
0
votes
1answer
101 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
126 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
119 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
748 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
2k 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
98 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
391 views

EF GroupBy query optimization

I have this method: ...