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
1answer
25 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 ...
2
votes
1answer
42 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 ...
0
votes
0answers
27 views

Implementing bulk big data insertion in async EF [on hold]

I am trying to parse a large data file (say 450MB of 380-bytes long lines) and insert corresponding records into MySQL database as fastest as possible, using Entity Framework. Normally, in Java/...
3
votes
2answers
165 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
53 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
158 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
90 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
65 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: ...
2
votes
1answer
115 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
148 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
57 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
70 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
1answer
79 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
67 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
324 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
146 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 ...
0
votes
1answer
73 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
123 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
111 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
49 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
100 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
106 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
340 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,...
2
votes
1answer
117 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
317 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
121 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 ...
1
vote
1answer
64 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 ...
1
vote
1answer
52 views

Calculating the .Sum() in Linq-to-SQL

I have the following code where I need to execute 2 Linq-to-SQL statements. If I do not have the Any() in the if statement, then ...
3
votes
0answers
63 views

Optimising looping through large data set and updating database

I have a database table storing information about documents (MigrationMaster). There is another table with security information on these (DocumentSecurity). There are 4 steps I can see that I need to ...
3
votes
1answer
1k views

WPF/MVVM with Entity Framework, Repository and Unit of Work pattern

I'm building WPF/MVVM application and I'm struggling implementing Unit of work pattern. The part, about which I'm not sure is UnitOfWork class. Here is my thought: ...
3
votes
1answer
154 views

WebAPI Authentication

Do you see any security issues with this authentication approach or have any suggestions? WebAPI is REST-based. The user logs in by calling the Authentication Controller and expects a 401 if ...
2
votes
2answers
154 views

Take a result set and organize it into a dictionary

I'm trying to take a result set and organize it into a dictionary then assign the dictionary values to variables that are publicly accessible from my controller. My issue is I have to check if there ...
1
vote
1answer
25 views

Mapping discussion entries from an SQL-View to objects

In my ASP.NET MVC application, I am loading Discussion Entry records along with User info (who posted the entry), Badges (assigned to the entry), Reactions (made to the entry like Facebook-style ...
3
votes
2answers
239 views

Sales order domain model with Entity Framework

I am wondering whether the following inheritance pattern is a good idea. I noticed that Sales Orders, Sales Quotes and Sales Invoices all follow a similar Master/ Detail pattern ( i.e a Header with ...
3
votes
1answer
1k views

Cloning Entity Framework entities

I'm currently writting piece of logic which copies entities from one user account to another. My current strategy in doing this is like that: Consider the following code: ...
0
votes
1answer
102 views

UnitOfWork without repository and transaction

I've created the unitofwork class below: ...
0
votes
1answer
126 views

Web API with IoC and database integration tests [closed]

I've made integration tests for a major part of my application. I test my dependency injection is set up correctly, creating controllers with it's dependencies going all the way to the database (using ...
2
votes
1answer
107 views

API controller with database queries

I have the following controller with a couple of database queries and I'd like you to review it. I've tried to make it clean for other developers but the communication with the database can be ...
4
votes
1answer
77 views

First time using entity framework with simple repository

I'm working on updating a GitHub project that I use at work, but I think the person abandoned the project as there is a pull request for it since 2014. At work we use a Repository pattern with ...
0
votes
1answer
120 views

Data layer using extension methods

I've started to use extension methods to provide data layer functionality in our project. Our project is an MVC website using Code First Entity Framework. So, I've done things like this: ...
1
vote
1answer
118 views

Passing model to _layout.cshtml

I have login page that looks like: It has a ViewModelBase and a ViewModel as: ...
2
votes
1answer
220 views

Repository pattern for books in EF6

I am working on a generic repository. And I wondered if anyone could give some feedback on it. Interface for DbContext: ...
1
vote
2answers
77 views

Inserting a (IoT) device into a database

In Service.Insert(), I call DeviceRepo.Insert() and in Service.Update(), I call ...
2
votes
1answer
460 views

Repository Pattern universal application

When I started learning Repository Pattern with Unity few days ago I was under impression that the main benefit of this pattern is the separation of data layer from the business layer. In other words,...
0
votes
1answer
125 views

Using EF 6.1 for updating objects and their children

I have an application that allows a user to create a poll that includes questions and answer choices as part of the poll. The hierarchy is a poll has one or more questions, a question has one or more ...
2
votes
1answer
97 views

Web-service for wiki-like movie database

I'm making a web-service for an app with a (partially) crowdsourced movie database. These two functions allows users to add and remove which genres a movie is liked to, and get the log of whom have ...
2
votes
1answer
57 views

Building a simple REST service using Web API 1.0

Friends, It's been several years since I last worked with the ASP.NET Web API framework. Even then I had developed with it minimally. I have a requirement for a service that will allow for the ...
3
votes
2answers
191 views

Building expression tree with multiple OrElse

I am creating a way for users to filter results based on start and end values. An example of this would be: ...
2
votes
1answer
64 views

Edit one table from another table in a Windows Form DataGridView

I have a Sales Order Program that allows each customer to have their own Part Number for one of our Stock Items. The Customer Part Numbers are stored in a separate table. I need to make this as low ...
1
vote
1answer
85 views

Domain Model for Simple Yes/No

Working from a C# and EntityFramework background. Jimmy Bogard makes the point of modelling your domain model correctly, such ...