.

Feature / ORMDataObjects.NetNHibernateEntity FrameworkLINQ to SQL

.

#h2#h2#h2#h2

.

Product description#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

VendorXtensiveCommunityMicrosoftMicrosoft

.

Product page (URL)dataobjects.nethttp://goo.gl/wVsDhttp://goo.gl/DOdOhttp://goo.gl/8w3e

.

Described version4.3.53.0 alpha 34.04.0

.

License typeCommercialLGPL (freeware)Part of VS.NETPart of VS.NET

.

Is source code available? + +--

.

#h2#h2#h2#h2

.

Integration & platform-related features#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Supported platforms ("supported" = "runs at")#h2#h2#h2#h2

.

 .NET 4.0 + + + +

.

 .NET 3.5 + + +* [1] +

.

 Runs under medium trust----

.

 Silverlight 4----

.

 Silverlight 3----

.

 Mono----

.

 .NET Compact Framework----

.

Supported IDEs#h2#h2#h2#h2

.

 Visual Studio 2010 + + + +

.

 Visual Studio 2008 + + +* [2] +

.

 Visual Studio 2005- +--

.

 SharpDevelop + +--

.

 Other +* [3] +--

.

Supported integration APIs / architecture#h2#h2#h2#h2

.

 True POCO / PI- + + +

.

 Disconnected scenario support / offline operation mode#h2#h2#h2#h2

.

  Via POCO / PI (i.e. implement it by your own)n/a + + +

.

  Via dedicated API +---

.

 WCF#h2#h2#h2#h2

.

  RIA Services- + (ext.) +-

.

  Data Services + + (ext.) + +

.

  Serialization + + + +

.

  .NET Remoting----

.

 ASP.NET#h2#h2#h2#h2

.

  ASP.NET data binding (integrated DataSourceControl, etc.)-* [4] + (ext) + +

.

  Current Session \ DataContext provider \ transaction
  bound to HttpApplication instance \ web request
+ +--

.

 WPF#h2#h2#h2#h2

.

  WPF data binding
  (integrated INotifyPropertyChanged / INotifyCollectionChanged)
+ + (ext.) + +

.

  IDataErrorInfo +---

.

  Additional classes simplifying building view models
  (e.g. auto-updating observable collections bound to query results)
- (planned)---

.

 Windows Forms#h2#h2#h2#h2

.

  Windows Forms data binding (IEditableObject, IListSource, etc.)-- + +

.

 Silverlight#h2#h2#h2#h2

.

  Analogue of WCF RIA Services for Silverlight----

.

#h2#h2#h2#h2

.

Mapping capabilities#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Mapping techniques#h2#h2#h2#h2

.

 Model-first (visual designer)- + (ext. $) + + (ext. $)

.

 Database-first (visual designer, reverse mapping)- + (ext. $) + +

.

 Database-only (ActiveRecord pattern, e.g. via T4)- (planned) + (ext.)* [5] + +

.

 Code-first (visual designer, forward mapping)- + (ext. $) + + (ext. $)

.

 Code-only + +- +

.

 Does not require any special DB strucutures to operate (e.g. views)opt.* [6] +-* [7] +

.

Mapping definitions#h2#h2#h2#h2

.

 Attribute-based + +- + (ext. $)

.

 XML-based mapping- + + +

.

 Runtime mapping definition API (a.k.a. fluent mapping) + +- +

.

Database object types#h2#h2#h2#h2

.

 Tables + + + +

.

  Partitions +* [8] + + +

.

  Indexes (known to ORM, can be used in queries,
  validation or schema upgrade)
+---

.

 Views- + + +

.

 Stored procedures- + + +

.

 Functions + + + +

.

 Triggers----

.

 Foreign keys + + + +

.

 Full-text indexes & catalogues#h2#h2#h2#h2

.

  Integrated (e.g. FREETEXTTABLE support for SQL Server) +---

.

  External (e.g. Lucene.Net)- +--

.

 Spatial types- +--

.

 UDTs (custom database types )----

.

Keys#h2#h2#h2#h2

.

 Key types#h2#h2#h2#h2

.

  Int32 / Int64 / GUID + + + +

.

  Other primitive types (String, DateTime, etc.) + + + +

.

  Composite keys + + + +

.

 Key generation techniques#h2#h2#h2#h2

.

  Sequences \ generators + +--

.

  Sequence (IDENTITY) columns- (planned) + + +

.

Inheritance mapping#h2#h2#h2#h2

.

 Inheritance mapping strategies (in Martin Fowler's terms)#h2#h2#h2#h2

.

  Single table / table per hierarchy + + + +

.

  Class table / table per type
  (each table contains declared properties only)
+ + + +

.

  Concrete table
  (each table contains declared + inherited properties)
+ + + +

.

 Large inheritance hierarchies support (efficient JOINs for TPT) +---

.

 Persistent interfaces (interface mapping) +---

.

 Type discriminators#h2#h2#h2#h2

.

  Manually specified + + + +

.

  Automatically provided +---

.

Associations (relationships)#h2#h2#h2#h2

.

 Typed references (true entity references instead of keys) + + + +

.

 Collections#h2#h2#h2#h2

.

  Entity sets + + + +

.

   Many-to-many w/o intermediate entity + + +-

.

  Entity lists or collections supporting item reordering----

.

  Dictionaries- +- -

.

 Automatic sync. of inverse (paired) associations +-- -

.

Persistent field types#h2#h2#h2#h2

.

 Nullable types + + + +

.

 Enum types + +- +

.

 Value types (complex types, structs, aggregates or analogue) + + + +

.

Mapping of generic types#h2#h2#h2#h2

.

 Descendants of fully parameterized generic type + + + +

.

 Fully parameterized generic types + +--

.

 Open generic types (automatic) +---

.

#h2#h2#h2#h2

.

Visual designer features#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Is visual designer provided?-- + +

.

Is visual designer optional?n/an/a- +

.

Required min. version of Visual Studion/an/a2010 [9]2010 [10]

.

Can work as standalone applicationn/an/a--

.

Code generation technique#h2#h2#h2#h2

.

 In-place (model change leads to immediate code change)n/an/a--

.

 T4n/an/a + +

.

 Custom template enginen/an/a--

.

Supports large models (works well with 500+ persistent types)n/an/a--

.

#h2#h2#h2#h2

.

Schema generation and upgrade#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Schema generation + + + +

.

Schema upgrade#h2#h2#h2#h2

.

 Design-time upgrade-- + +

.

 Runtime upgrade +-- + (ext.)

.

 Indexes are upgraded as well (removal \ creation) +---

.

Version-to-version migration pattern support
(a.k.a. "migrations" in Ruby on Rails)
+---

.

#h2#h2#h2#h2

.

Queries#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

LINQ + + + +

.

 Score @ ORMBattle.net LINQ test, 100 is maximum98.328.979.389.3

.

 Traversal through
 (automatically adds JOINs / uses subqueries for)
#h2#h2#h2#h2

.

  Entity references + + + +

.

  Entity sets + + + +

.

 Subqueries
 (IQueryables inside predicate \ projection expressions)
#h2#h2#h2#h2

.

  Aggregates (someQueryable.Max()) + + + +

.

  Non-correlated subqueries
  (reducable to INNER JOIN or nested SELECT)
+ + + +

.

  Correlated subqueries (requires APPLY on SQL Server) + - + +

.

 LEFT OUTER JOINs#h2#h2#h2#h2

.

  Via .Select with .DefaultIfEmpty() +- + +

.

  Via custom extension method to IQueryable (e.g. .JoinLeft) +---

.

 Projections (.Select) #h2#h2#h2#h2

.

  Non-tail projections (.Select([anything]).AnyQueryableMethod(...)) +- + +

.

  Subqueries (.Select(from ... in ... select ...)) +-* [11] + +

.

  Anonymous types (.Select(new {...})) + + + +

.

  Custom types (e.g. DTOs, .Select(new AnimalDto {...}) +---

.

 Order by / group by#h2#h2#h2#h2

.

  Anonymous type (.GroupBy(x => new {...})) +- + +

.

  Aggregate (.GroupBy(someQueryable.Max()) + + + +

.

  Mapped property or field of Enum type + +n/a +

.

  Mapped property or field of entity type
  (incl. entities with composite keys)
+ +--

.

  Mapped property or field of value type (complex, structure, etc.) +---

.

 .Take / .Skip#h2#h2#h2#h2

.

  Maintains already known order /
  does not require .OrderBy right before .Take / .Skip
+-- +

.

 Large local collections
 (... where oneMillionOfGuids.Contains(entity.Id))
+---

.

 Interface queries (query by supported & mapped interface) +---

.

 Full-text queries + ---

.

 Custom LINQ translator extensions +---

.

 LINQ query translation steps
 (query languages \ models in translation pipeline)
LINQ, RSE, SQL DOM, SQLLINQ, HQL, SQLLINQ, CQT, SQL LINQ, SQL query model, SQL

.

Other query languages#h2#h2#h2#h2

.

 Supported query languagesRSE
(OO query model)
HQLeSQL-

.

 Full-text queries + +--

.

Custom / direct SQL execution + + + +

.

#h2#h2#h2#h2

.

Performance#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Query related performance features#h2#h2#h2#h2

.

 Generated SQL is ready for query plan caching + + + +

.

 Compiled queries + - + +

.

 Delayed / future queries (a.k.a. multi-query) + +--

.

 Update / delete / insert queries
 (bulk updates via single SQL statement)
- +--

.

 On-demand (partial) materialization + -- -

.

 MARS support + -- -

.

Statement batching#h2#h2#h2#h2

.

 Automatic CUD statement batching + + - -

.

 Automatic Full batching (CUD + queries) +- - -

.

 Manual CUD statement batching----

.

Partial and eager fetches#h2#h2#h2#h2

.

 Eager fetches / prefetch paths / .Include#h2#h2#h2#h2

.

  JOIN-based-* [12] +* [13] + +

.

  Batch-based (batched, on-demand queries) +---

.

 Partial entity state caching (lazy loading) + + + +

.

 Partial collection content caching
 (only .Count, only a part of items, etc.)
+'+--

.

Fast key generation techniques#h2#h2#h2#h2

.

 Hi-Lo algorithm + +--

.

 Sequential GUID generation algorithm + (ext.) + (ext.) + (ext.) + (ext.)

.

Caching#h2#h2#h2#h2

.

 L1 cache (per unit of work / session / DataContext) + + + +

.

 L2 cache (per domain / AppDomain)- (planned) +- -

.

  Integrated API for caching query result in L2 cache- (planned) +- -

.

  Can use external cache (Velocity, memcached, etc.)- (planned) +- -

.

#h2#h2#h2#h2

.

Operational features#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Session / DataContext / UoW features#h2#h2#h2#h2

.

 Identity map mode / uniquing + +* [14] + +

.

  GC-friendly mode (weak entity referencing) + ---

.

 Stateless mode (analogue of IStatelessSession in NHibernate)- +--

.

 "Ghost objects"
 (objects, that can't be cast to actual type of entity they represent;
 a property, not feature; its presence has its own pros and cons)
- +--

.

Persistence engine#h2#h2#h2#h2

.

 Cascading updates / deletes + + + +

.

 Automatic ref. dependency ordering / loop breaking + + + +

.

 Automatic flushes (before queries, etc.) + +--

.

Transactions#h2#h2#h2#h2

.

 Outermost (regular) transactions + + + +

.

 Nested transactions / savepoints +---

.

 Long-running transactions#h2#h2#h2#h2

.

  Actually long transactions
  (requires stateless mode / weak L1 cache, on-demand
  materialization, etc.)
+ +* [15]--

.

  "Long conversation" pattern
  (requires disconnected mode or serializable session)
+ +

.

 Distributed transactions- (planned) [16] + + +

.

 Local (in-memory only) transactions#h2#h2#h2#h2

.

  Local transactions (1-level undo or true "cancel changes") + + (ext.)--

.

  Nested local transactions (N-level undo) +---

.

Concurrency control#h2#h2#h2#h2

.

 Pessimistic + + + +

.

 Optimistic (entity version checks on updates) + + + +

.

Change tracking#h2#h2#h2#h2

.

 Change tracking
 (requires O(changedEntityCount) on each SaveChanges)
+- + +

.

 Dirty checking
 (requires O(readEntityCount) on each SaveChanges)
- +--

.

 Change extraction
 (ChangeSet or similar type; extract-transmit-apply pattern)
+- + +

.

 Manual
 (SaveChanges(newEntity, oldEntity) or analogue)
+* [17] +* [18] +* [17] +* [17]

.

Operation logging#h2#h2#h2#h2

.

 System (predefined) operations +---

.

 User-defined operations +---

.

Lifecycle events#h2#h2#h2#h2

.

 Per session / DataContext (i.e. events for any entity or collection) + + + +

.

 Per entity or collection (either events or virtual methods) + +* [19] + +

.

 Atomicity of visible state change in multi-action scenarios
 (pairing, removal, etc.)
+---

.

Validation#h2#h2#h2#h2

.

 On commit (automatic) + +* [20] +* [20] +* [20]

.

 On demand (manual) + +* [20] +* [20] +* [20]

.

 Continuous (automatic, on each change) +---

.

Entity code generation / interception / AOP features are based on#h2#h2#h2#h2

.

 Unused / not necessary (i.e. only user-provided code is used)-opt.--

.

 Custom tool (SqlMetal, etc.)--- +

.

 T4-- +-

.

 Runtime code generation#h2#h2#h2#h2

.

  System.Reflection.Emit
  (faster for small models, slower for large models)
-opt. [21]opt.-

.

  System.CodeDom
  (faster for large models, slower for small models)
----

.

 Compile-time code generation (PostSharp, etc.) + (PostSharp)---

.

Unification#h2#h2#h2#h2

.

 Unified "key" object (abstraction from primary key structure) +- +-

.

 Unified "version" object (abstraction from object version structure) +---

.

 Unified exception types (DeadlockException, etc.) +- +* [22]-

.

#h2#h2#h2#h2

.

Supported databases#h1#h1#h1#h1

.

#h2#h2#h2#h2

.

Microsoft#h2#h2#h2#h2

.

 SQL Azure + + + +

.

 SQL Server 2000- + + +

.

 SQL Server 2005 + + + +

.

 SQL Server 2008 + + + +

.

 SQL Server 2008 R2 + + + +

.

 SQL CE (Compact Edition) + + + +

.

Oracle#h2#h2#h2#h2

.

 Oracle 9 + + +-

.

 Oracle 10 + + +-

.

 Oracle 11 + + +-

.

Sybase#h2#h2#h2#h2

.

 Adaptive Server Enterprise---

.

 Advantage Database Server- + + (ext.)-

.

 SQL Anywhere- + + (ext.)-

.

MySQL 5.X- (planned) + + (ext. $)-

.

PostgreSQL 8.X + + + (ext.)-

.

IBM DB2- + + (ext.)-

.

Amazon SimpleDB----

.

Firebird Server 2.X- + + (ext.)-

.

SQLite- + + (ext.)-

.

VistaDB-- + (ext.)-

.

Microsoft Access----

.

Integrated + (in-memory DB)---

.

Other (rarely used DBMS)----

.

.

Uber cool - totally 270+ rows!
[1] Entity Framework 1.0 (previous version) supports this platform.
[2] Entity Framework 1.0 (previous version) supports this version of Visual Studio.
[3] Any MSBuild-based environment is supported.
[4] There is no DataSourceControl descendant for now, but property-based 2-way data binding fully works there.
[5] Via Castle.ActiveRecord.
[6] Does not require special structures in Legacy mode.
[7] Requires special views.
[8] Only if you manually configure the partitions (e.g. using SQL Server Management Studio).
[9] Entity Framework 1.0 (previous version) supports Visual Studio 2008.
[10] Previous version of LINQ to SQL supports Visual Studio 2008.
[11] Only scalar subqueries are supported, i.e. support of this feature quite limited.
[12] Supported only for 1-1 mappings via projections (.Select).
[13] Not supported in LINQ.
[14] Can work w/o identity map via IStatelessSession.
[15] IStatelessSession allows to run transactions of arbitrary length, but w/o tracking. On the other hand, NH materializes the whole query result on enumeration, so you can't deal with really large query results anyway.
[16] In near-time plans.
[17] Not available, but technically possible.
[18] Via IStatelessSession.
[19] Via interception.
[20] No built-in events, but it's pretty easy to implement this.
[21] Supports Castle, LinFu and Springs.
[22] Provided hierarchy doesn't translate SQL exceptions, thus it does not allow to identify e.g. deadlocks with easy. See http://goo.gl/HhCR