Questions tagged as 'entity-framework'

3
answers

To what extent is it not advisable to use an ORM?

I'm working on a very large system using .NET (Asp.net MVC) application requires a critical level of performance . To what extent is it worth using an ORM? Is there any tool that I can compare in terms of ORM's performance and pure SQL? I kn...
asked by 28.04.2014 / 21:38
3
answers

What is the difference between using virtual property or not in EF?

I have my models public class Cliente { public int Id {get;set;} public string Nome {get;set;} } and public class Pedido { public int Id {get;set;} public int ClienteId {get;set;} public virtual Cliente Cliente {get;set;} }...
asked by 04.03.2015 / 03:26
4
answers

Should I use GUID or int as a primary key?

I'm about to start a new project in MVC 4 with Entity Framework, searching I found several examples here in the SOpt of models that use GUID as ID and some doubts have arisen: What is the advantage of using GUID as a primary key? Is it feas...
asked by 19.06.2014 / 21:38
1
answer

Best Practices for Inserting, Altering, and Deleting with EntityFramework

For deletion of records you may not have, but for Insertion and Amendment I believe there should already be something discussed. The best recommended practice on Insertion and Change is ViewModel's , where you create a view that is appropri...
asked by 26.10.2014 / 16:24
2
answers

Is there an opposite for 'contains'?

I have a list: List<int> lista1 = new List<int>(); lista1.Add(1); lista1.Add(2); lista1.Add(3); List<int> lista2 = new List<int>(); lista2.Add(1); lista2.Add(2); To get from lista1 elements that also exist in...
asked by 12.08.2015 / 21:54
2
answers

Why is AddRange much faster than Add?

I'm working on a data integration between two bases, and I'm using Entity Framework for this. I then generated the following code, which iterates each record in the Situations table of base dbExterno and feeds my base db :...
asked by 11.12.2013 / 18:36
3
answers

What is the advantage of using the Set method?

What is the advantage or difference in using the Set<> method, and can I do the same without it as in alternative 2? Alternative 1 var aluno = contexto.Alunos.First(x => x.Id == entidade.Id); contexto.Set<**Aluno**>()....
asked by 22.09.2015 / 00:39
2
answers

How to Lambda in Extension Methods with multiple Lists?

There are the following Objects: public class Objeto1 { public List<Objeto2> PropObj1 {get; set;} } public class Objeto2 { public List<Objeto3> PropObj2 {get; set;} } public class Objeto3 { public int PropObj3 {get; set;...
asked by 10.08.2015 / 22:55
1
answer

How Lazy Load Entity Framework works

It's the following personal, so I saw in Entity to use Lazy Load you leave the property without the virtual keyword , and eager with the virtual. However, I have seen in some blog posts that staff use the Configuration.EnableLazyLoad...
asked by 09.06.2014 / 19:36
2
answers

How to implement the Standard Repository in C # with EF?

I want to make an implementation of the Repository pattern where I'll be using EntityFramework and have the following: p> Interface IRepository : public interface IRepository<T> where T : class { T GetById(int id);...
asked by 16.05.2014 / 21:37