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
1answer
68 views

Linq group by with multiple where, sum clauses in select causes a timeout

I have linq query that extracts a summary of my sales quantities item group wise. This query causes an sql ...
1
vote
0answers
29 views

Using IoC Container with Entity Framework Repository Pattern

I am using WPF with Entity Framework 6 (DB first), Caliburn.Micro, and MEF. I am trying to ...
2
votes
0answers
21 views

Get a grouped list with relational data

I am new to C# and am leaning ASP.NET MVC and Entity Framework and I am trying to create an application where a user can manager Job Postings and Applicants where an Applicant can apply for many Jobs. ...
3
votes
1answer
40 views

Dynamically initializing Context and creating connection string for Web API

Scenario: There is a 20 years old windows application with SQL Server as database. There are 42 companies within the Group and each company has its own database. Now we have started building new ...
3
votes
0answers
52 views

Entity Join slow query

I've never participated in a codereview before and I was pointed that I should in another thread for a slow query. ...
3
votes
1answer
59 views

log and throw in dot net

I read a bit about log and throw and anti-pattern and so on, but I still not get exactly what's the problem. I'm using entity framework and I want to log every exception appearing with its complete ...
4
votes
2answers
90 views

Copy an Entity With Navigation Property in C#

I have Table that name is Asset and Each Asset have Schedules . I ceate a method for Copy entity Like this : ...
3
votes
1answer
394 views

Is my n-tier architecture of this web API correct?

I'm making a web API using web API 2. I have three layers: Business - Stores models and repository classes. Data - Just EF. Currently one DB. But will include 3 when complete. Web API - Presentation ...
2
votes
1answer
79 views

Handing multiple workflows cleanly in LOB application

Background I'm about to build a LOB application that resembles an e-commerce solution (without paying and being open to the public). It will be used to receive orders for fulfillment purposes based ...
7
votes
4answers
999 views

Storing Enum values as Strings in DB

I have a Data First Migration and have been struggling a little with storing an enum value as a string. (Im aware that enums should be stored as ints but, personally I have never liked this, yes ...
1
vote
0answers
34 views

Join via navigation properties with collection

There are some related collection objects in my table and I'm trying to get list with joining this tables. But this code is seems bad: Entities that shortened: User: ...
3
votes
3answers
95 views

Claiming coupons

I am currently creating a system that allows a user to claim a coupon, after the coupon is claimed the receive currency on their account. I recently ran into an issue in which if 2 requests with the ...
-1
votes
1answer
60 views

Normalized ecommerce data model

So there's not much here to "normalize" the database (really only the OrderItems class and maybe the Table Meta class as well) but I'm relatively happy with it. My ...
5
votes
1answer
112 views

Multiple doubts about Repository pattern

I have implemented the Repository pattern in my Web APi 2 + Entity Framework 6.1 + Angular 1.4 SPA site. The application allows management of a martial arts club. One of its functionalities is to ...
3
votes
2answers
99 views

User can add and delete customers

I am using asp.net core entitiy framework. The page displays the customers. The user can add new customers or delete existing ones. I am looking for ways to improve my code. Here is my cshtml page ...
3
votes
2answers
243 views

Scraping HTML via async controller & classes + HTML agility pack

I've developed a simple application to grab golfer index scores from a website that has no API. The application works but is very slow, with 6 users that require updating takes 60 seconds. I've tried ...
5
votes
2answers
533 views

Ordering data by boolean

I have a bit of EF Lambda code which returns a list of data from the db table, then orders by a field called IsDefault At first, the code was ...
4
votes
3answers
119 views

Setting Entity Framework up for success

So I am working on an application (top-secret!) that I need settings for, these settings are pretty basic, but I don't want to make a single-row table with a bunch of serialized settings, or a single-...
3
votes
4answers
456 views

Check if the user exists

Scenario: Check if the user exists If yes: update the details Else: insert the user details ...
3
votes
2answers
84 views

Batch save with progress reporting

I reviewed this question that in my opinion uses a not so pretty batch-save so I tried improve it and this is what I came up with. In this more generic solution that allows to reuse it I wanted to ...
3
votes
1answer
49 views

Generic method for checking database integrity on soft delete

I have written this generic method to check whether a object has a dependent items or not: ...
2
votes
0answers
184 views

Using T-SQL SEQUENCE with Entity Framework 6

After reading many posts about how to handle sequences in EF 6 (see below) I found a way that was working for me. I'm using Code First and want to include the sequence from scratch, so without using ...
3
votes
0answers
231 views

Custom generic repository pattern

This weekend I made an attempt at a generic repository pattern for entity framework in .NET after reading this blog post. I was wondering how it could be better. I specifically have a couple questions....
4
votes
1answer
357 views

Proper way to work with stored procedures in Entity Framework Core

I need to work with stored procedures, with the help of Entity Framework Core. This is my function: ...
3
votes
2answers
510 views

ASP.NET core proper way to work with the repository pattern

I am currently working on my first ASP.NET Core MVC project with a repository pattern. I have gotten it to work but I wonder if there is a better way to solve this. In this case I have an ...
3
votes
1answer
74 views

EF code-first solution architecture, which exposes freely the data repo to the UI controllers

I have a project template and like to usually work with the following setup (grossly simplified, but that's the gist of it). CompanyName.ProjectName.Business.Entities I define my business objects. I ...
3
votes
1answer
214 views

Service class with db context

I have implemented service which working with db context. I am using entity framework and I do not need repositories because logic is quite simple. I want to keep simple logic but clean approach. One ...
4
votes
1answer
61 views

IQueryable Extensions working on expression for collection property

Followup to Repository searching code duplication My goal currently is to make my current implementation of my repository's IQueryable filtering less duplicative. First, I looked into passing ...
4
votes
2answers
175 views

Migrating data using entity framework, linq and recursion

I have a piece of code to migrate data from an old app to a new app. The data represents the user's websites. In the old app the user only had one section for websites, on which you could add any ...
2
votes
2answers
99 views

Repository searching code duplication

A followup question to this: IQueryable Extensions working on expression for collection property I am working on a project for a family member which involves the use of a database and a repository, ...
4
votes
1answer
95 views

Retrieving website categories from a three-level hierarchy

I've been trying to fix this performance bottleneck in my web app for a while now. Here is what the data looks like on my web page: Here is how I get this data in the controller: ...
3
votes
1answer
687 views

MVVM - ObservableCollection & Entity Framework DbContext

I'm trying to catch WPF using MVVM pattern, where my set of models is implementing ObservableCollection as well as Entity Framework's ...
1
vote
1answer
621 views

Push notifications to clients with SignalR c#

In my web application I want to load all data to client side from the server on power up. After that I want all communication be managed through Signalr - meaning that each update the server will send ...
1
vote
1answer
163 views

Manage Signalr notifications with offline users

In my web application I want to load all data to client side from the server on power up. After that I want all communication be managed through Signalr - meaning that each update the server will send ...
4
votes
2answers
86 views

Mix of Repository and UOW For Business Library with Entity Per Table Architecture

I am trying to use Entity framework along with UOW in business class where I want to use this layer across multiple types of applications like web, webapi and Windows Services. So I cooked something ...
2
votes
0answers
140 views

Deriving classes to decorate auto-generated base class code with attributes

Background: I am currently in the process of abstracting and refactoring out EF for Dapper with ...
4
votes
2answers
78 views

Search for variants of keywords using LINQ

First, I'm adding words entered into a search field to an array. Then, I'm getting results from a stored procedure on SQL Server using Database First approach with Entity Framework. Finally, for ...
1
vote
2answers
372 views

Entity Framework configuration

I tried to refactor my code with entity framework configuration, splitting in multiple private methods, one per entity, each responsible for configuring things related to that entity and only that ...
5
votes
1answer
224 views

Localized Enum in C# 6

I had to jump through some hoops to get a localized enum working. I went through dozens of SO articles that never actually answered the relevant conundrum with a working solution. So I made my own: I ...
1
vote
2answers
105 views

Controller method to update properties of a request

I have a view that displays details of a work order request submitted by a user. As far as security and database querying is concerned, which one of the following options would be better if I'm going ...
3
votes
1answer
165 views

Specification pattern in EF part 2

This is a follow on to Part 1 In order to use my new Specifications within expression trees so I can use them in projections/navigation collections I had to write ...
5
votes
2answers
212 views

Specification pattern in EF part 1

I've been experimenting with different ways of reusing (and naming) the expressions I use in Entity Framework. I've tried static fields with Expressions and ...
-4
votes
1answer
51 views

EntityFramework code-first - right place for entity “import” function [closed]

I have an EF-driven Repository pattern implementation. Roughly looks like this: ...
3
votes
1answer
117 views

Entity Framework query optimization

A user can track a show, and mark episodes and seasons of that show as watched. To support this I have the models below: Models ...
7
votes
1answer
138 views

GET with paging, sorting and filtering

I have a GET method that handles paging, filtering, and sorting. Development has been fairly rapid and I'm not completely sold on some of the implementation. A few assumptions have to be made for this ...
1
vote
3answers
581 views

ASP.NET Product Listing

I am working on a e-shop in ASP.NET MVC, and I just made the listing of product the way I figured out this night. Is it correct? Or should I make it differently? How? So this is my Product controller,...
3
votes
1answer
144 views

Select query helper for nolock and no change tracking

I often need to switch connection strings and databases (dev/prod) and I need to be able to execute queries with the NOLOCK flag. For this purpose I create a few ...
3
votes
3answers
659 views

Improving time it takes to insert thousands of records using Entity Framework

I have a task in my program that is inserting thousands (94,953 in one instance and 6,930 in another) of records into my database using Entity Framework. Right now I am doing this and calling the <...
4
votes
1answer
126 views

Retrieving collections from a database

I have two collections that I want to retrieve from the database and associate with each other. My solution works, however I know it isn't the most elegant one. Do you have any suggestions on how to ...
2
votes
1answer
107 views

Simple repository for a small/medium sized ASP.NET MVC site

I am about to start a small/medium sized project. I am by no means a software architect. But I tend to question every move I make at times, since I want to do things correct. I found a way to ...