Wednesday 23 April 2008

Comparing to Linq to SQL

Hello,

Recently I took some time to investigate Entity Framework (CTP3) and Linq to SQL (RTM) further. While going through the examples I compiled following list with benefits & concerns. Maybe you have made a list for your own? Maybe you would care to comment. Please do so!


Linq to SQL



Benefits


  • Already available in VS2008 RTM
  • Generation of partial classes based on the database schema
  • Relationship are also detected and modelled as special properties in the entity classes
  • You work with these entity classes in you application.
  • Generated classes can be augmented with custom methods
  • Generated classes can be augmented with partial methods
  • LINQ support to specify queries
  • Dynamic generation of SQL (you do not have to write SQL your self)
  • Databinding support
  • Lazy loading (default) and immediate loading flexibility
  • Updating only changed columns
  • Optimistic Concurrency support through mapping directives.

Concerns


  • Basis mapping capabilities ( 1 table -> 1 Entity)
  • Only SQLServer
  • Distributed application requires special attention (dataContext)
  • Designer lets you start from a blank model but I haven't found something to create a database schema from the entity model.
  • Serialization of entity classes only set if generated with SQLMetal command-line tool option.

Entity Framework

Benefits

  • Generation of partial classes based on the database schema
  • Designer lets you start from a blank model but I haven't found something to create a database schema from the entity model.
  • You work with these entity classes in you application.
  • Generated classes can be augmented with custom methods
  • LINQ support to specify queries
  • Dynamic generation of SQL (you do not have te write SQL your self)
  • Databinding support
  • Normally foreseen to accommodate multiple database systems
  • More flexible mapping capabilities than Linq To SQL (fine-grained entity model, Inheritance mapping flexibility, etc)
  • Generated classes by default serializable
  • Data driven Object-modelling point of view
  • Lazy loading (default) and immediate loading flexibility

Concerns

  • Promised to be shipped with SP1 VS2008
  • Distributed application requires special attention (ObjectContext)
  • Designer lets you start from a blank model but I haven't found something to create a database schema from the entity model.
  • In the designer you can not add behaviour in the model( somewhat normal because it is a DSL for data persistence but still....). Entity are now more geared towards a data-container role.
  • Two flavours to query the databases system (linq to entities and entity SQL). At this moment I'm not very sure when to use which.

So if you have other points of interest or remarks , I would like to hear them.

Thanks in advance.

Best regards,

Alexander

3 comments:

Taylor Bara said...
This comment has been removed by the author.
Hailey said...

This is a great post thanks for writing it

Spacebar counter said...

Medium is a place to read articles on the Internet. Medium is a blogging platform, like Wordpress or Blogger. Medium is the new project from the guys who brought you Twitter. Medium is chaotically, arrhythmically produced by a combination of top-notch editors, paid writers, PR flacks, startup bros, and hacks. Spacebar test