VS2010 and .NET Framework 4 Beta 2 Announced!


The information in this post is out of date.

Visit msdn.com/data/ef for the latest information on current and past releases of EF.


Visual Studio 2010 and the .NET Framework 4 Beta 2 are now available for download by MSDN subscribers and will available to the rest of the world on Wednesday. Beta 2 as well the VS2010 Launch date of March 22, 2010 were announced this morning on Soma’s blog.

Included in Beta 2 are some great new features and updates for the Entity Framework 4 and ADO.NET Data Services 4.

Entity Framework 4 Beta 2

In addition to all of the new EF 4 features that were included in Beta 1, Beta 2 also includes:

  • Foreign Keys: EF 4 now includes a new type of associations (Foreign Key Associations) that allow you to have Foreign Key properties on your entities. Foreign Key Associations simplify some key scenarios such as Data binding and can be included or excluded when using the model creation and update wizards. Independent Associations supported in .NET 3.5 remain as is, but Foreign Key Associations become the default type of association going forward. Referential integrity constraints can now be created from the designer.
  • Improvements to POCO Support: Fix-up of changes to navigation properties and FKs is now performed automatically on DetectChanges and SaveChanges. It is also now possible to declare collections as ISet<T> in POCO objects. When either ICollection<T> or ISet<T> is used, the default collection type materialized is HashSet<T>, which among other advantages does not allow duplicate entries.
  • Lazy Loading on by Default in new Models: When you create a new model in VS 2010, you get generated ObjectContext types that have lazy loading turned on by default (context.ContextOptions.LazyLoadingEnabled = true is placed in the constructor). This simplifies the default experience of working with objects. Of course, it is still possible to turn it off and do explicit and eager loading.
  • EntityDataSource support for Query Extenders and POCO: EntityDataSource now includes support for ASP.NET Query Extenders and POCO entities. Query Extenders are a new addition to ASP.NET that allow you to have more control over the data retrieval query of a Data Source, leveraging the LINQ capabilities of Entity Framework.
  • Support for Binary Keys: The EF now allows you to have binary property types (and varbinary storage columns) mapped as Entity Key / Foreign Key.
  • ObjectMaterialized event: It is now possible to write logic that is executed immediately after an object has been materialized. This event is raised after the scalar, complex and reference properties are populated (collections are filled afterwards).
  • Object Services API improvements to enable N-Tier and Self Tracking Entities: ObjectStateEntry.GetUpdatableOriginalValues method provides a access to an updatable data record that you can use to establish the original state of an entity at the property level.
  • Improvements to the generated SQL: Numerous simplifications and improvements of the SQL generated when querying using the Entity Framework have been done including: removal of joins, better translation of certain functions,  elimination of constants used for internal purposes, which results in removing of levels of nesting and others.
  • Navigation Property Management: Users can now delete and add navigation properties, enabling the creation of one-way associations.
  • Improved Database Generation: SQL CE support has been added. In addition, customization of database generation is significantly simpler now, with the ability to specify the DDL generation template to be used, as well as automatic discovery of installed database generation workflows and templates.
  • New Extensibility APIs: New APIs enable users to add custom properties to any object in the model and have those properties show up in the property sheet. In addition, other extension points allow for customization of models on load, save, and after the model creation and update wizards run.
  • Generation of Complex Types from Stored Procedures: When creating a function import from a function, the UI can now detect the columns returned from a stored procedure and create a corresponding complex type. In addition, existing complex types can be updated when a stored procedure definition changes.
  • Greatly Improved Facet Management: The designer can now distinguish between empty and blank values, and various property facet defaults are handled more cleanly and consistently.
  • LINQ to Entities improvements: Support for recognizing additional patterns in queries, simplification of EntityFunctions and SqlFunctions static classes and OrderBy is now lifted over filters and other operations.

ADO.NET Data Services 4 Beta 2

  • Projections: This ADO.NET Data Services URI format has been extended to express projections (i.e. you can now work with a subset of the properties of an entity).  Beta 2 includes both server and client library (including LINQ support) support for projections.   
  • Data Binding:  The data services client library for the .NET Framework 3.5 SP1 and Silverlight2 has been extended to support two-way data binding for WPF and Silverlight based applications. 
  • Row Count: One scenario we heard a ton of feedback on after shipping V1 of ADO.NET Data Services in the .NET Framework 3.5SP1 is the ability for the a client of a data service to determine the total number of entities in a set without having to retrieve them all.  To address this need, we have extended the data services addressing scheme to allow a client to obtain this type of information without having to download all the entities in a set.
  • Feed Customization (aka "Web Friendly Feeds") : A common ask we have received is to provide the ability to customize how entities are mapped into the various elements of an AtomPub feed.  This feature does just that by providing a data service author declarative control over how the data service runtime maps the properties of an entity (e.g. a Customer, Order, etc) to the elements of a feed.
  • Server Driven Paging (SDP) : This one is best described by example.  If you had a data service that exposes photos, you likely want to limit the total number of photos a single request to the service can retrieve because the total collection of photos may be very large.  This feature allows a service author to set per collection limits on the total number of entities returned for each request.  In addition to limiting the number of photos returned per request, the server provides the client a "next link" which is simply a URI specifying how to continue retrieving the rest of the entities in the collection not returned by the first request.  For those familiar with AtomPub, this feature adds support for AtomPub <link rel="next" ...> elements to the data service runtime.  
  • Enhanced BLOB Support: This feature enhances the BLOB support provided in V1 to enable data services to stream arbitrarily large BLOBs, store binary content separate from its metadata, easily defer the loading of BLOB content when its metadata is requested, etc. 
  • Request Pipeline: We have started to expose events throughout the data services server request processing pipeline.  For this release we’ll expose request level events and in future we’ll look to expose more fine grained events based on your feedback.  The goal of exposing our processing pipeline is to allow services further transparency into a data service such that a service author can do things such as setting HTTP response cache headers, wrapping interceptor processing and data service request processing in a single transaction, etc.   
  • New "Data Service Provider" Interface for Custom Provider Writers: As the data services runtime has evolved, so has the number of ways people want to plug data into the data service framework.  In V1, two methods (Entity Framework and arbitrary .NET classes) were supported to enable a data service to interact with various diverse data sources.  To address another class of environments and data sources we have introduced a way to write a "custom" provider for those cases when the previous two provider models don't meet your needs.

Thank you,

Elisa Flasko
Program Manager,
Data & Modeling Group