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

2
votes
3answers
78 views

Using Linq to select the first and last values

I want to get just the first and last values in a date range. I have the following code: using (var myEntities = new dataEntities()) { var myValues = (from values in myEntities.PointValues ...
1
vote
1answer
47 views

Feedback and Advice on my N-Tier Application Architecture

I am working on an application that will use an N-Tiered approach. I would appreciate any feedback and advice on my architecture before I proceed any further. DataLayer (Class Library Project) ...
2
votes
0answers
34 views

Repository pattern and unit of work

I implement 2 distinct class from an repository interface public interface IRepository<T> { bool TryGet(Func<T, bool> predicate, out T entity); T Get(Func<T, bool> ...
0
votes
0answers
20 views

Abstract repository for entity framwork

I write abstract repository using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Linq; using System.Linq.Expressions; namespace ...
3
votes
2answers
94 views

Refactoring from .. in .. select to more compact one

Is it possible to write the two following lines of code in a more compact one? IEnumerable<int> collection = from partnerNumbers in contract.Contact.PartnerNumbers select partnerNumbers.Pnr; ...
1
vote
2answers
97 views

How to optimize/refactor this method?

Here is my method: public JsonResult ValidateAll(string toys) { Dictionary<string, object> res = new Dictionary<string, object>(); List<string> result_check = new ...
0
votes
1answer
99 views

How can I implement the generic repository pattern and improve the performance for the code below?

I've used EF-DB first approach and have written a simple app to retrieve the data from the database and show it in the view. The code is simple and ok for a beginner like me, but how can I implement ...
4
votes
1answer
181 views

Looping through columns in Entity Framework

Is there a cleaner/more efficient way to loop through the columns in EF implicitly than the way written below? static void Main(string[] args) { using (var db = new someDbContext()) { var ...
3
votes
1answer
97 views

Code-First TPT, TPC, or incorrect inheritance?

My question is: based on the business need below, should I use Table-Per-Type, Table-Per-Class/Concrete-Type, or am I misusing inheritance in the first place? If TPT, will the query performance ...
2
votes
2answers
73 views

Optimizing a distinction code

List<int> types = new List<int>(); foreach (var d in myTableList) { if (!types.Contains((int)d.item_type)) types.Add((int)d.item_type); } I have a table in db called myTable. ...
3
votes
1answer
84 views

Optimization of code for searching in db

This is my code: var test = (from x in myDb.myTable where (x.name == tmp || x.name == tmp2 || x.name == tmp3) && x.unit == u select x).FirstOrDefault(); if (test == ...
1
vote
0answers
22 views

AlwaysUpdate attribute for Entity Framework Code First POCO

The entity framework will only save properties it detects has changed via its proxy classes. I have a situation where I want a property to always be saved no matter if it changed or not. I wrote a ...
1
vote
1answer
427 views

Entity Framework & Unit Of Work Design issue with Repository & DI, Please Help

I am facing a problem to save data using UnitOfWork. I mean I am unable to save data using UnitOFWork.Commit() from Controller class. My Implementation check bellow. IUnitOfWork public interface ...
1
vote
2answers
88 views

Is my code (clean code separation) is correct?

The code below is an approach of clean code separation, but I am confused if it is a right approach or wrong. Please suggest me. public interface IRepository<T> { ...
3
votes
0answers
357 views

Correct usage of EF's DBContext in ASP.NET MVC application with Castle Windsor

I am trying to use Entity Framework as simple as posible. Use UnitOfWork and Repository patterns seems to be overkill because whole web application will be pretty straightforward. I came with this ...

1 2 3 4 5
15 30 50 per page