Posted by Viral Sarvaiya on August 14, 2012
In my current company we have discussion about what is the difference between LINQ to SQL Vs Entity Framework and I get following conclusion from the surfing from internet (off course from google. 🙂 )
LINQ to SQL supports one to one mapping of database table or views or procedures or functions
Entity Framework map single class to multiple tables of database. Means you can map one table to multiple entities or multiple table to one entities.
LINQ to SQL does not support the creation of complex types
Entity Framework support the creation of complex types.
LINQ to SQL is easy to use
Entity framework is more complex compared to LINQ to SQL.
While introduction of LINQ to SQL it supports only sql server and letter on “DBLINQ” that can use with mysql, sqllite or other DBs
Entity Framework plug with any database server like DB2, Sybase, Oracle, SQL Azure and other.
In LINQ to SQL, inheritance is difficult.
Entity Framework is simple to apply because it supports Table per class and table per Type.
LINQ to SQL file type is DBML
Entity Framework File type is EDMX.
LINQ to SQL has DataContext object which we can query the database,
Entity Framework, we can query database using LINQ To Entities through the ObjectContext object and ESQL(provides SQL like query language). In addition, Entity Framework has ObjectQuery class(used with Object Services for dynamically constructing queries at runtime) and EntityClient provider(runs query against conceptual model).
LINQ to SQL is slow for the first time run, after first run acceptable performance.
Entity Framework is also slow for the first but performance is good then LINQ to SQL after first run.
LINQ to SQL has not capability to generate database from Model
Entity Framework has capability to generate database from Model.
Posted in .Net, ASP.NET, asp.net feature, LINQ | Tagged: Entity Framework, linq, LINQ to SQL, Object Relational Mapping, ORM, SQL | Leave a Comment »
Posted by Viral Sarvaiya on September 5, 2011
Recently I have do some work in new technology – NHibernate.
NHibernate is same as JAVA’s Hibernate Core in .net framework. NHibernate is object-relational mappers(ORM). It handles persisting plain .NET objects to and from an underlying relational database. with an XML description of your entities and relationships, NHibernate automatically generates SQL for the objects.Persistent classes do not need to implement any interface or inherit from a special base class. This makes it possible to design the business logic using plain .NET (CLR) objects and object-oriented idiom.
NHibernate key features:
Natural programming model – NHibernate supports natural OO idiom; inheritance, polymorphism, composition and the .NET collections framework, including generic collections.
Native .NET – NHibernate API uses .NET conventions and idioms
Support for fine-grained object models – a rich variety of mappings for collections and dependent objects
No build-time bytecode enhancement – there’s no extra code generation or bytecode processing steps in your build procedure
The query options – NHibernate addresses both sides of the problem; not only how to get objects into the database, but also how to get them out again
Custom SQL – specify the exact SQL that NHibernate should use to persist your objects. Stored procedures are supported on Microsoft SQL Server.
Support for “conversations” – NHibernate supports long-lived persistence contexts, detach/reattach of objects, and takes care of optimistic locking automatically
Free/open source – NHibernate is licensed under the LGPL (Lesser GNU Public License)
For More details :
Posted in .Net, asp.net feature | Tagged: .net, NHibernate, NHibernate for .NET, object-relational mappers, ORM | Leave a Comment »