Why you can't project mapped entity in entity framework

If you have worked with entity framework for a long time with and linq of course, you probably have seen the Error: The entity cannot be constructed in a LINQ to Entities query. So when it happens and why? Think about the following peace of code:

  1. public IQueryable<Lesson> GetAllLessons(int termId)
  2. {
  3.     return from p in db.Lessons
  4.            where p.termId == termId
  5.            select ... Continue

Repository Pattern practice in data access layer via entity framework

To read about definitions of Repository patter refer to here or here and then let's begin! I'm gonna to show the using of repository pattern with entityframework in Data access layer. Sorry about the example because it's about product , category , brand , blah blah again! First of all create an interface called IAggregateRoot

  1.    public interface IAggregateRoot
  2.     {
  3.     }
  4. <... Continue

Nhibernate vs Entity Framework

Entity framework and nhibernate are two famous ORM for developers. Both of them have been used in many projects and each of them has it's own cons and pros and common features as well. I'm gonna list some of them here. I personally like both of them and experienced in several projects. both Frameworks are used for processing relational data to domain specific objects. Both NHibernate and the Entity Framework provide the capabilities required to implement an O... Continue

Getting started with Entity Framework

 What is Entity framework !?

MSDN answers to this question :"Entity Framework is an Object Relational Mapper (ORM). It basically generates business objects and entities according to the database tables provides ability to do CRUD operations , relations and etc."

And also about wikipedia's definition : "The Entity Framework is a se... Continue