The ADO.NET Entity Framework is a set of ORM (Object-Relational-Mapping) tools for the .NET Framework, since version 3.5 SP1.
1
vote
1answer
53 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 ...
0
votes
1answer
37 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
56 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
37 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
1answer
41 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
31 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
76 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
59 views
Optimize OrderBy Generic Method
Here is my OrderBy method which includes concatenated column names.
Can this be achieved more efficiently?
...
1
vote
1answer
82 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
37 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
73 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 ...
-1
votes
0answers
52 views
performance issue of application using entity framework 6
I have a console application in which I used Entity framework 6. In order to reduce the time of the first instanciation and the first read operations . I used Three ...
0
votes
1answer
77 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
62 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
49 views
Entity Database Add/Update method
What would be the most elegant way to refactor the following method?
...
1
vote
1answer
39 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:
...
0
votes
0answers
27 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
79 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
78 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
47 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
85 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
42 views
EF Code First BaseContext-class [closed]
I've seen a tutorial where a dbcontext base class is created like so:
...
3
votes
1answer
89 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
78 views
8
votes
2answers
92 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
116 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
57 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
127 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
69 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 ...
2
votes
1answer
146 views
DbGeography search query
I have a situation in which I need to get the closest road to a DbGeography point.
This takes 5 - 8 seconds to run in some cases.
I have a ...
2
votes
2answers
147 views
Linq-to-Sql Contains an int? inside a list of int
Curious if there is a better way to write a repository method that receives argument List<int> and checks if the database ...
2
votes
2answers
62 views
Sales Tax problem (new version)
I was told that this version is too simple, that need something more complex. I added Entity Framework.
Here my code:
...
3
votes
2answers
68 views
View Model Constructor Arguments
I have created a ViewModel for a Product Edit page because it has specific related entities I need to load - the class currently looks like this:
...
1
vote
1answer
569 views
Entity Framework 7 In Memory Database - Unit Testing using xUnit
I'm using EF7 with In-Memory database and xUnit for repository testing. I'd like to know if it's a good practice initializing the database in this manner for reuse it in every test method, ...
0
votes
2answers
62 views
3
votes
0answers
94 views
Unit of work with Repository pattern
I am trying to work on a WPF application and decided to go for Unit of Work and Repository pattern, along with MVVM. I am using Entity Framework as my ORM. Could ...
0
votes
0answers
65 views
Unit of Work by using Windsor Castle
I want to implement Unit of Work patter with the usage of Windsor Castle in order to controll the trasanctions and sessions. What I did till now is:
My business class methods:
...
3
votes
1answer
51 views
Extracting SoftDelete from DbContext
I have a DbContext with a SoftDelete implementation inside it. To make it more clear and maintainable, I wanted to extract it to ...
3
votes
3answers
505 views
Master detail INSERT in Entity Framework 6 Database First MVC 5
I have a DB with a master table called "facturas" and another detail table "facturas_detalle." I would like to insert to them, so this is a "Database-First".
I need some guidance or advise of best ...
1
vote
0answers
108 views
Update Virtual Property in a Code First Model using Independent Association in Entity Framework 6
I have a Model that looks like this:
...
4
votes
1answer
68 views
Resolve entity behaviour based on enumeration type
The core of this question is removing a Static Class smell from my Web-Api/MVC solution. It presently works but feels kind of dirty.
Present Solution
Standard solution with 6 projects:
MVC
Api
...
-3
votes
1answer
77 views
Which way is better (matching Onion Architecture in MVC pattern) for using Provider?
In onion arch. we have multi layer structre:
UI (User interface).
BL (Business Logic / Services).
RE (Repositories).
UI uses BL to get data from RE with some conditions, my question is which is ...
3
votes
1answer
488 views
Run stored procedure from repository using EF
I need to dynamically call a stored procedures from my repository, and here is a my implementation:
...
3
votes
1answer
1k views
EF Generic Repository + Unit of Work pattern with support for Async
I'm working on a generic repository using EF 6 code first and trying to following the Unit of Work pattern. Unity is being used to inject my repositories, and I'm trying to get everything supporting ...
3
votes
1answer
225 views
N-tiered web app to save a role
My project manager is saying that there are many bad things in my code, but they are not helping me to correct it. Can you please specify the bad things they mean?
I have 7 projects in my solution ...
0
votes
0answers
256 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 ...
2
votes
1answer
116 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 ...
2
votes
1answer
550 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
46 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
66 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:
...