The ADO.NET Entity Framework is a set of ORM (Object-Relational-Mapping) tools for the .NET Framework, since version 3.5 SP1.
7
votes
1answer
81 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
195 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
82 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
205 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 <...
3
votes
1answer
109 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 ...
0
votes
0answers
40 views
Simple repository for a small/medium sized asp.net mvc site. Using entity framework
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 ...
2
votes
1answer
30 views
Need to get rid of .Any() to calculate the .Sum() in Linq-to-Sql
I have the following code where I need to execute 2 linq-to-sql statement. If I do not have the Any() in the if statement, then ...
3
votes
0answers
51 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
174 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
0answers
78 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
128 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
23 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
178 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
197 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
73 views
0
votes
1answer
78 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
64 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 ...
2
votes
0answers
46 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
83 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
49 views
Passing model to _layout.cshtml
I have login page that looks like:
It has a ViewModelBase and a ViewModel as:
...
2
votes
1answer
118 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
72 views
Inserting a (IoT) device into a database
In Service.Insert(), I call DeviceRepo.Insert() and in Service.Update(), I call ...
2
votes
1answer
171 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
58 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 ...
1
vote
1answer
77 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
49 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
107 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
48 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
79 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 ...
2
votes
1answer
69 views
Optimize OrderBy Generic Method
Here is my OrderBy method which includes concatenated column names.
Can this be achieved more efficiently?
...
1
vote
1answer
236 views
DAL basic implementation using Entity framework 6 and Autofac
Would like to ask for a code review for my DAL. I use Entity framework 6 and Autofac for ...
-1
votes
1answer
40 views
LINQ to SQL code - in models project or in db project
I currently have two projects. One called Models, a second called TaskEntityModels, a model first ...
5
votes
1answer
87 views
Paginating blog posts from SQL server using nested LINQ statements
I made an ASP.NET MVC application using Entity Framework for code-first migrations to the SQL Server database. I also use Unity (DI/IoC) for managing the services and repositories.
I made an overview ...
0
votes
1answer
132 views
Method or helper function to return objects from EntityFramework with Linq [closed]
The following code reads from Microsoft EntityFramework 6.0 domain model and returns the single view_patient object. The view_patient object is defined in the backend database and uploaded to the ....
2
votes
1answer
78 views
Return most recent DateTime C# Entity Framework
Job -> Many Quotes
Quote -> EmailLogList
EmailLogList -> Many EmailLogs
I want to return a CreatedDate from an EmailLog which has been created most ...
0
votes
1answer
76 views
Entity Database Add/Update method
What would be the most elegant way to refactor the following method?
...
1
vote
1answer
48 views
Eager Loading Deeply into a Model with a Collection Property Whose Type is Inherited
Visual Studio generated this great route for me, where I can load an entity:
...
1
vote
0answers
45 views
Get a list of inherited classes using Linq to Entities
I have inherited classes in Entity Framework. I have a base class (ArticleBase) and two classes Review and Article which inherit from it. I am returning a list of the latest Articles and Reviews ...
1
vote
2answers
101 views
Entity framework - code first data access
I'm looking for your opinions about ways to improve the access to data in my application. I develop web applications, using Entity Framework 6 code first, and Autofac for dependency injection.
Before ...
2
votes
2answers
95 views
Medical appointment book history
This code correctly returns a View_appointment. Is there a better way to
accomplish this with using left joins and unions? I'm trying to learn Linq a little bit ...
4
votes
1answer
65 views
EF IQueryable Extension Methods
I've started building extension methods for my EF classes like below because it makes building queries so easy, and the intellisense provided helps keep people from writing a new Where() clause in ...
2
votes
1answer
110 views
Custom data validation approach for store items and prices
I came up with a validation design for my project and wanted to hear if there's anything I could improve.
Here's how it works. I have the models (code first)
...
-1
votes
1answer
52 views
EF Code First BaseContext-class [closed]
I've seen a tutorial where a dbcontext base class is created like so:
...
3
votes
1answer
181 views
Utilizing Areas to handle subdomains with shared state/resources
I am currently working on a side-project and have the basic foundation and architecture I want in place for the site. I wanted to get your opinion and thoughts on my current practices and methods ...
4
votes
1answer
90 views
8
votes
2answers
95 views
Code First approach, feeding the table
I have a database (PostgreSQL) from which I want to migrate some data to a MS SQL Server database. I decided to use a code first approach. The question is related to the proper way of feeding my new ...
5
votes
2answers
308 views
Query Builder pattern with use of FluentApi
Recently, I've come up with an idea of building a custom query builder combine with FluentApi.
Expected usage:
...
3
votes
1answer
66 views
Entity Framework Code First Softball Stats Database Schema
I am creating a website for my buddies and I to track all of our offensive softball stats. I am getting tired of maintaining a huge excel spreadsheet and emailing it out every week, so a website is ...
3
votes
2answers
141 views
Keeping data processing out of controllers
I would like to start by mentioning that I am LAMP stack guy who happens to be making my first ever .NET C# web app and I'm seeking general advises for best practices and to see how more experienced ...
1
vote
2answers
73 views
A polling method and nested loop
There are 12 gates. Using our face recognition system, we check every person who tries to enter each gates. My MVC web application is to show the result data to the gate-keeper. And this is the ...