Freigeben über


What’s new with Entity Framework in Visual Studio 2010 RC


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 .NET Framework 4 RC was announced earlier this week on Soma’s blog.

Included in this release are a set of improvements in Entity Framework runtime and designer. Here are some of the highlights:

Entity Framework

  • Better N-Tier support: Visual Studio 2010 now includes code generation templates for  Self-Tracking Entities. You no longer have to download the Entity Framework Feature CTP to get this functionality. Self-Tracking Entities are POCO classes that can track their changes. This makes them ideal for many N-Tier scenarios.

Please note that previous versions of Entity Framework Feature CTP include Self Tracking Entities that are incompatible with Visual Studio 2010 RC, so please do not install EF Feature CTP 1 or EF Feature CTP 2 on top of Visual Studio 2010 RC.

  • DDL Generation Provider: Entity Framework now includes DDL generation and the ability to create a database based on a model. Methods to create and delete database and to check existence of a database are now available on ObjectContext. If you have used Code-First capability in the Entity Framework Feature CTP (previously known as Code Only), you are already familiar with this functionality. Any Entity Framework provider can support DDL generation. Provider specific details can be found here

New versions of Code First and POCO Template for Visual Studio 2010 RC are currently in the works and will be released shortly – please watch this blog for details.

In addition to the two new features mentioned above, there are a lot of improvements that are either bug fixes or performance improvements. Some of the fixes include:

  • ProxyDataContractResolver can be used with DataContract serialization to serialize POCO Proxies as the original POCO types
  • Issue with stored procedure update of multiple entities has been fixed.
  • Improvement to make multi-file T4 code generation fall back to single file generation in WebSites.
  • Improvements to FK support for entities that don't do fixup
  • Reduction of ViewState footprint of EntityDataSource
  • EntityDataSource sets DataKeyNames correctly at design-time

Entity Framework Designer

Entity Framework designer includes bug fixes and performance improvements in this release. Some of the improvements include:

  • Indexes added on foreign keys in Model-First scenarios
  • Ability to attach CopyToSSDL XMl attribute to CSDL annotations – this causes them to be copied to SSDL during Model-First
  • Better control over key definition for views so that unusable keys inferred during reverse engineering can be fixed
  • Better control of StoreGeneratedPattern value for table columns by setting it on the mapped property in the model
  • View definition and StoreGeneratedPattern is preserved during SSDL update from database
  • Support for SQL Azure connections

These are just a few of the changes you can expect to see. As you try Entity Framework and the Designer, let us know what you think of some of these improvements.

Entity Framework Team

Comments

  • Anonymous
    February 12, 2010
    Hi ! Nice news! How about 2nd Level caching ? I think this is the most wanted feature after POCO support ! And this is what make me go using NHibernate.. Thanks ADO.NET team for their great work !

  • Anonymous
    February 12, 2010
    I installed VS 2010, but dont found EntityConfiguration class, for code-only. I still referencing CTP2 to work....

  • Anonymous
    February 12, 2010
    Hi, Any ETA for the new POCO template? Thanks

  • Anonymous
    February 13, 2010
    What is with T4 template for POCO? Where can I get T4 template for POCO in Entity framework? Thanks

  • Anonymous
    February 14, 2010
    Do the VS2010RC Designer fixes still apply to models that target 3.5SP1?  The View keys and StoreGeneratedPattern problems have rendered the VS2008 designer useless to me.

  • Anonymous
    February 14, 2010
    Same here....really need new T4 POCO Template for RC :|

  • Anonymous
    February 16, 2010
    Same here as well :-) Please give us these T4 POCO templates as soon as possible :-)

  • Anonymous
    February 17, 2010
    Please give us Code First as soon as possible.

  • Anonymous
    February 17, 2010
    Another call for the POCO template here.  Thanks

  • Anonymous
    February 18, 2010
    @Yoann: thanks for your feedback. Second level cache is certainly one of the features we are considering for future releases. However, we cannot promise when this is going to arrive.

  • Anonymous
    February 18, 2010
    @Felipe: The Feature CTP 3, that includes a new version of Code First (we are changing the name of Code Only moving foward) was announced today: http://blogs.msdn.com/adonet/archive/2010/02/18/entity-framework-feature-ctp-3-now-available.aspx.

  • Anonymous
    February 18, 2010
    @Flavien, Michael, Ingimar, Marc, Alec The ETA for the POCO Template is... now. Please see the announcement: http://blogs.msdn.com/adonet/archive/2010/02/18/entity-framework-poco-template-updated-for-visual-studio-2010-release-candidate.aspx

  • Anonymous
    February 24, 2010
    Will you put an option to set the navagability between classes? In EF V1 the navegability are always "in both sides".

  • Anonymous
    February 24, 2010
    Just an idea, wouldn't be better to trigger the state change by calling something else than "OnPropertyChanged", perhaps is just a matter of nomenclature, but it would be nice to distinguish between real data members that trigger change tracking, and the other "dependent" properties that need to invoke propertychanged events just for data binding.

  • Anonymous
    February 26, 2010
    When will we be able to re-order entity properties? It feels very unnatural and immature to not be able to do something so simple. Also and more importantly, when will we be able to actually do model first development? What I mean is, currently only 50% of the functionality required for model first development is included because we can not edit the store tables/views/sprocs. What good is model first if there's nothing to map your entities to? You can't expect us to use the often inadequate wizards for everything can you? Thanks, Eric

  • Anonymous
    February 26, 2010
    Are there any solid examples out there, possibly from the P&P team, of best practices using EF 4 in a multi-tier architecture?

  • Anonymous
    February 28, 2010
    @Eric, with regards to your model first comments, is the scenario that you already have database tables and you want to build a conceptual model that maps to them? Currently you can build a conceptual model and run the 'database generation' wizard (or use the power pack: http://bit.ly/8akJIs) to generate your SSDL and generate/migrate your database schema. You can also go the other way and incrementally update your conceptual schema from the database through the 'Update model from database' feature. In your scenario, would a feature like 'Update SSDL from database' be useful for you? As in, we bring in the database objects into the SSDL so you can map your conceptual model to them - but we don't touch that conceptual model. Or would you prefer to truly edit the SSDL (create, etc.) to match what's in the database?

  • Anonymous
    March 02, 2010
    @adiunni I have faced this issue in a few scenarios. The first is where I already have database tables and want to build a conceptual model that maps to them, like you said. However, I only want to map a few tables at a time. I do not want to import the whole database schema. The second scenario is when I need to make small changes to the database and then update the model to reflect the change, or the reverse. Right now, such small changes require regenerating your database, or your model. If you have important data in your database then this becomes even more difficult. Also, you then lose any customizations made in either the model or database such as DELETE and UPDATE rules for Many-to-many relationships. In Beta 2 (Not sure about RC) EF does not define DELETE rules for many-to-many relationships and consequently errors when deleting any entity part of such a relationship because the constrained junction/join/link table records are not deleted as well. Another scenario is where someone else makes changes to the database which you then need to update your SSDL and MSL to reflect. In most cases an 'Update SSDL from database' function could be very useful. However, the basic purpose of the EF is to map between entities and database objects. This means I should be able to define my entity model, then define my database schema, and then define the mapping between the two. Import export wizards make sweeping changes. Sometimes those sweeping changes save a lot of time, and sometimes they over-complicate seemingly simple tasks. Thanks, Eric

  • Anonymous
    March 03, 2010
    @Eric, Looking at the first scenario, we do provide the ability to just import a subset of tables/views/sprocs, however I can understand the pain of needing to run Update Model again after you've done that, and seeing those customizations get replaced. We definitely hear you w.r.t. the comments about 'incremental' changes in both directions (app->db, db->app) that preserve data/schema. We're actively working on this. The 'Update SSDL' feature is one possible solution but I understand the pain point of not being able to map the database objects as they are available. We've heard from several people about this and we're looking at this too. Thanks a lot for your feedback; it definitely helps us in determining what will add the most value to the next version. -adi

  • Anonymous
    April 20, 2010
    I have to ask - why is it that since launch you haven't supported unsigned types? Every type of data storage medium (SQL, etc.) support signed/unsigned. .NET/C#/VB/etc. support signed/unsigned. Pretty much everything supports signed and unsigned integers - why is entity framework the exception?

  • Anonymous
    July 06, 2010
    Will there be support for enumerations in the future version of EF?

  • Anonymous
    July 10, 2010
    The comment has been removed

  • Anonymous
    October 07, 2010
    How about new of Concurrency Handling in EF 4?

  • Anonymous
    October 07, 2010
    please send your answer to my email trungthanhhue@gmail.com. Thanks