Share via


EF Extensions for Visual Studio 2010

The EF Extensions sample has been updated for Visual Studio 2010. It’s available for download here. Nothing new in this release… some features have actually been removed because they’re no longer needed in .NET 4.0.

  • The EF proper now includes an ObjectSet<TEntity> class that makes the old EntitySet<TEntity> EFExtensions class redundant. The FindOrAttach and GetTrackedEntities methods from the original EFExtensions sample are preserved as extension methods over ObjectSet, but the EntitySet class is no more. A cheat sheet for people upgrading from EntitySet to ObjectSet (just some name changes):
Before After
Microsoft.Data.Extensions.EntitySet<T> System.Data.Objects.ObjectSet<T>
InsertOnSaveChanges(T) AddObject(T)
DeleteOnSaveChanges(T) DeleteObject(T)
FindOrAttach(T) extension method in DataExtensions
GetTrackedEntities(T) extension method in DataExtensions
Metadata EntitySet
  • The Zip helper method is redundant with System.Linq.Enumerable.Zip.
  • The LINQ ExpressionVisitor class is now public, so Microsoft.Data.Extensions.ExpressionVisitor has been replaced with System.Linq.Expressions.ExpressionVisitor.

Quick aside on ExpressionVisitor: a couple of devs have mentioned a “bug” to me in the shipping ExpressionVisitor implementation. It’s actually a bug fix relative to the visitor code that has circulated via various blogs (including this one). The VisitMemberInit() method now visits the MemberInitExpression.NewExpression expression but requires that the returned expression is a NewExpression. This may cause trouble for partial evaluator implementations that unwittingly assume that, for instance, ‘new Foo { X = … }’ can be rewritten as ‘Constant(new Foo()) { X = … }’.

Although the EF now supports richer mapping of stored procedures and includes some ‘drill-through-to-the-underlying-store-provider’ surface, a few remaining gaps allowed Materializer, CreateStoreCommand and company to survive the chopping block in this release of EFExtensions. Some remaining benefits of the sample library: multiple result sets from stored procedures, the power of a complete programming language to describe result transformations, and support for arbitrary result shapes.

Thanks,
-C

Comments

  • Anonymous
    November 24, 2014
    The comment has been removed