Freigeben über


Announcing the Microsoft Entity Framework June 2011 CTP

 


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.

If you have previously installed this preview, please follow the uninstall instructions detailed below .


We are excited to announce the availability of the Microsoft Entity Framework June 2011 CTP. This release includes many frequently requested features for both the Entity Framework and the Entity Framework Designer within Visual Studio.

What’s in Entity Framework June 2011 CTP?

The Microsoft Entity Framework June 2011 CTP introduces both new runtime and design-time features. Here are some of the new runtime features:

  • The Enum data-type is now available in the Entity Framework. You can use either the Entity Designer within Visual Studio to model entities that have Enum properties, or use the Code First workflow to define entities that have Enum objects as properties. You can use your Enum property just like any other scalar property, such as in LINQ queries and updates.
  • Two new spatial data-types for Geography and Geometry are now natively supported by the Entity Framework. You can use these types and methods on these types as part of LINQ queries, for example to find the distance between two locations as part of a query.
  • You can now add table-valued functions to your entity data model. A table-valued function is similar to a stored procedure, but the result of executing the table-valued function is composable, meaning you can use it as part of a LINQ query.
  • Stored procedures can now have multiple result sets in your entity data model.
  • The Entity Framework June 2011 CTP includes several SQL generation improvements, especially around optimizing queries over models with table-per-type (TPT) inheritance.
  • LINQ queries are now automatically compiled and cached to improve query performance. In previous releases of the Entity Framework, you could use the CompiledQuery class to compile a LINQ query explicitly but in this CTP this happens automatically for LINQ queries.

There are several new features for the Entity Framework Designer within Visual Studio:

  • The Entity Designer now supports creation of Enums , spatial data-types and table-value functions from the designer surface.
  • You can now create multiple diagrams for each entity data model. Each diagram can contain entities and relationships to make visualizing your model easier. You can switch between diagrams using the Model Browser and include related entities on each diagram as an optional command.
  • The StoreGeneratedPattern for key columns can now be set on an entity Properties window and this value will propagate from your entity model down to the store definition.
  • Diagram information is now stored in a separate file from the edmx or entity code files.
  • When you import stored procedures using the Entity Model Wizard, you can now batch import your stored procedures as function imports. The result shape of each stored procedure will automatically become a new complex type in your entity model. This makes getting started with stored procedures very easy.
  • The Entity Designer surface now supports selection driven highlighting and entity shape coloring.

Getting the Microsoft Entity Framework June 2011 CTP

The Microsoft Entity Framework June 2011 CTP is available on the Microsoft Download Center and there are three separate installers. You will need to have Visual Studio 2010 SP1 to install and use the new Entity Designer. All three installers are available here and should be installed in the following order:

  1. Download and install the runtime installer for the Entity Framework 2011 CTP runtime components.
  2. Download and install the WCF Data Services 2011 CTP installer to use new features in WCF Data Services with the Entity Framework.
  3. Download and install the designer installer to use the new Entity Framework 2011 CTP entity designer within Visual Studio 2010 SP1.

Getting Started

There are a number of resources to help you get started with this CTP.

Targeting the Microsoft Entity Framework June 2011 CTP Runtime

The easiest way to use the CTP is to set your project’s target framework to Microsoft Entity Framework June 2011 CTP. This target framework allows use of the CTP versions of the Entity Framework assemblies in addition to the standard .NET 4.0 RTM assemblies.

To re-target a C# project:

  • Right-click the project in the Solution Explorer and choose Properties or select <Project> Properties from the Project menu.
  • On the Application tab, select Microsoft Entity Framework June 2011 CTP or Microsoft Entity Framework June 2011 CTP Client Profile from the Target framework dropdown.

  • A dialog box will appear indicating that the project needs to be closed and reopened to retarget the project. Click Yes.

To re-target a VB.NET project:

  • Right-click the project in the Solution Explorer and choose Properties or select <Project> Properties from the Project menu.
  • Select the Compile tab and click the Advanced Compile Options… button on the bottom left of the dialog.
  • Select Microsoft Entity Framework June 2011 CTP or Microsoft Entity Framework June 2011 CTP Client Profile from the Target framework dropdown.

  • Click Ok.
  • A dialog box will appear indicating that the project needs to be closed and reopened to retarget the project. Click Yes.

Walkthroughs

For assistance in using the new design-time and runtime features please refer to the following walkthroughs:

Support

The Entity Framework Pre-Release Forum can be used for questions relating to this release.

Uninstalling

We recommend installing the Microsoft Entity Framework June 2011 CTP in a non-production environment to avoid any risk associated with installing and uninstalling pre-release software. If the CTP is uninstalled, existing functionality installed with Visual Studio 2010 (such as the Entity Designer) may no longer be available. To restore the features that were removed, complete the following steps:

  1. Locate the Visual Studio 2010 installation DVD and insert it into your computer. If you are using an Express SKU of Visual Studio and don’t have the installation media, you can obtain new media here

  2. Launch an administrative-level command prompt and execute one of the following commands. These commands restore versions of the EF Tools files that were initially shipped with Visual Studio 2010.

    With Ultimate, Pro, or other non-Express SKUs:
    [DVD drive letter]:\WCU\EFTools\ADONETEntityFrameworkTools_enu.msi USING_EXUIH=1

    With C# Express, VB Express, and Visual Web Developer Express SKUs:

    [DVD drive letter]:\[VBExpress, VCSExpress, or VWDExpress]\WCU\EFTools\ADONETEntityFrameworkTools_enu.msi USING_EXUIH=1

  3. To update the EF Tools with what shipped with Visual Studio Service Pack 1, there are two options:

    To run an update only for EF Tools, create a DVD with Visual Studio Service Pack 1 and execute the following command from an administrative-level command prompt. This update will only take a few minutes to complete.

    msiexec /update [DVD drive letter]:\VS10sp1-KB983509.msp /package {14DD7530-CCD2-3798-B37D-3839ED6A441C}
    To avoid creating a DVD, reapply SP1. Launch the Uninstall/Change programs applet in the Control Panel, double-click on Microsoft Visual Studio 2010 Service Pack 1, and then choose the option to “Reapply Microsoft Visual Studio Service Pack 1.” This approach will take longer since all of SP1 will be applied, not just the EF Tools file updates.

What’s Not in the Entity Framework June 2011 CTP?

There are a number of commonly requested features that did not make it into this CTP of the Entity Framework. We appreciate that these are really important to you and our team has started work on a number of them already. We will be reaching out for your feedback on these features soon:

  • Stored Procedure or table-valued function support in Code First
  • Migration support in Code First
  • Customizable conventions in Code First
  • Unique constraints support
  • Batching create-update-delete statements during save
  • Second level caching

Thank You

It is important for us to hear about your experience using the Entity Framework and we appreciate any and all feedback you have regarding this CTP or other aspects of the Entity Framework. We thank you for giving us your valuable input and look forward to working together on this release.

ADO.NET Entity Framework Team

Comments

  • Anonymous
    June 30, 2011
    AWESOME!!!! Can not wait to start using some of these sweet new features!

  • Anonymous
    June 30, 2011
    The comment has been removed

  • Anonymous
    June 30, 2011
    EF needed 3 major releases (4.x) and a CTP to support enums...

  • Anonymous
    June 30, 2011
    The comment has been removed

  • Anonymous
    June 30, 2011
    Excellent work ... Been waiting a long time for this as we started a major project with TPT a while ago that has been suffering from performance issues.  Great job ADO.net Team :)

  • Anonymous
    June 30, 2011
    Hi, Will be possible to map a private field in one-to-many relationship? For example: public class Order {    private List<OrderItem> itens;    public void AddItem(OrderItem item) { }    public IEnumerable<OrderItem> OrderItens { get; set; } }

  • Anonymous
    June 30, 2011
    Issue when uninstalling to be aware of see uploadingit.com/.../EFTools+Uninstall+Error.png You cannont edit EF diagram after uninstall of CTP so install on VM. Steve

  • Anonymous
    June 30, 2011
    Sweeeeeeeeeeeettt. Can't wait to really dig in. Nice job guys.

  • Anonymous
    June 30, 2011
    The comment has been removed

  • Anonymous
    July 01, 2011
    @Carl That sort of mapping where you either map to a private field or map to an IEnumerable<> with Add/Remove methods is not yet supported by the Entity Framework. That kind of object mapping, along with things like supporting factory methods and non-default ctors, is a common ask and is something we'd like to address in the product.

  • Anonymous
    July 01, 2011
    @crazyRaisy, Your model asserts that there can only be 0 or 1 Conversion for any given PowerCurve.  You would need to modify your model to be 1:* for that association, e.g.:                       1                          * [PowerCurve]---------------------------[Conversion]

  • Anonymous
    July 05, 2011
    The new release look really great, Is there any plan for a RTW version or "go live" version ?

  • Anonymous
    July 05, 2011
    When is the next versioned "release" going to happen? CTP's are great to understand what's coming next, but we're really looking to the ADO.Net team to tell us when they stand behind the bits for app developers to put into their production code...

  • Anonymous
    July 05, 2011
    Hi, It seems WCF Data Sercvices still doesn't support  EF using the fluent API. The runtime doesn't call  the OnModelCreating method of DbContext so it doesn't get configured (In my case to ignore some properties and classes). Is it correct or I am doing something wrong?

  • Anonymous
    July 07, 2011
    It would be great to see some improvements or even help on using EF Code First in a disconnected environment.  The duplicate entities in object graph problem is driving us mad, and although there's quite a lot on the web about it, no real solutions, or anything on Code First in particular.

  • Anonymous
    July 08, 2011
    Do you have any performance results you would like to share for the automatically compiled linq queries ? How much difference does it make ? (roughly)

  • Anonymous
    July 09, 2011
    I'm still not clear why the CTP was implemented in such a way that you're forced to target a specific framework. Even EF 4.1 simply required adding a Nuget package to your project.

  • Anonymous
    July 10, 2011
    Did you guys fix the annoying problem of truncating any entity name ending with "Status" to "Statu" when generating the model from a database?

  • Anonymous
    July 10, 2011
    Could you explain what do you mean with "Batching create-update-delete statements during save"? Thanks!

  • Anonymous
    July 11, 2011
    Can we look forward to support for HierachyID as well in a future CTP/Beta? It would be fantastic to have parity between the SQL 2008 UDTs and EF after 3 years of waiting...

  • Anonymous
    July 11, 2011
    Just wanted to say thanks! It's great to know that you guys are working on new features all the time and I think the rapid-release schedule is a huge help as well. Can't wait for SP support in code first along with the other goodies you mentioned. I'm now using code first in multiple production applications and I am absolutely loving it. Keep up the good work!

  • Anonymous
    July 11, 2011
    I was very skeptical that this would make much of an improvement. However, this reduces times in scenarios 5 fold. A process that was previously taking 60 seconds now takes 12 seconds. While not ideal (and the actual SQL taking just 0.2s to run) this is much better. When can we expect a proper release that we can use on our production environments?

  • Anonymous
    July 11, 2011
    Hi Guys I would suggest that more effort is placed on Code First (for e.g. stored proc support) instead of the visual designers. Im in the position of evaluating EF v.s. NHibernate v.s,. other ORM frameworks and the visual designers are not pushing EF to the top of the list. You need to at least match NHibernate else it will be hard for us to make that move to EF. And yes I know there are many great features not supported in NHibernate that are supported in EF but interception is quite a big problem. We have many situations where we have to run complex logic when an entity is saved to the DB.

  • Anonymous
    July 12, 2011
    How can one uninstall EF 4.1 June CTP? I don't see that in Windows 7's Programs and Features list.

  • Anonymous
    July 13, 2011
    I really want to know an estimate realease date for this CTP. The last one was released in July 2011, so I assume for the new realse it would take +6months ?!?!

  • Anonymous
    July 13, 2011
    I installed in the order above on an XP machine and the designer wont open. I have correctly targeted all the projects in the solution to EF June 2011 CTP. Any ideas?

  • Anonymous
    July 14, 2011
    Struggling to uninstall JUNE 2011 CPT from XP. Any suggestions?

  • Anonymous
    July 15, 2011
    Could you update ideas on uservoice to updated and completed?

  • Anonymous
    July 17, 2011
    What's the difference between  Microsoft Entity Framework June 2011 CTP and  Microsoft Entity Framework June 2011 CTP Client Profile?

  • Anonymous
    July 20, 2011
    In version 4.1 I noticed a difference in SQL generation in a TPT inheritance model between having an abstract base class and having a plain (non-abstrctact) base class. Now in the June 2011 CTP it looks like the SQL generation improvements, as mentioned in this blog post, only apply to the non-abstract variant. Can someone please shed a light on why the SQL is generated differently and whether this issue is going to be resolved in the next release? For details please visit thedatafarm.com/.../entity-framework-june-2011-ctp-tpt-inheritance-query-improvements

  • Anonymous
    July 24, 2011
    I am getting the following exception: LINQ to Entities does not recognize the method 'Boolean HasFlag(System.Enum)' method, and this method cannot be translated into a store expression. My LINQ is something like:                questionList = (from qs in ic.Questions                                where qs.Complexities.HasFlag(complexity)                                select qs).ToList(); My complexity enum is defined as:    [Flags]    public enum ComplexityEnumFlags : byte    {        None = 0,        Easy = 1,        Medium = 2,        Hard = 4    } If Linq to Entitties does not support Has Flags, what is the suggested way to tackle this?

  • Anonymous
    July 26, 2011
    @Nikhil: Enum.HasFlag is not supported in LINQ to Entities, at least not yet. The expression "instance.HasFlag(flag)" is semantically equivalent to "instance & flag == flag" (notice this is using bitwise "and" operator). You should be able to write the query above like this: from qs in ic.Questions where qs.Complexities & complexity == complexity select qs Hope this helps.

  • Anonymous
    July 26, 2011
    @Diego: Thanks. That did the trick. I have another question: How do I load an object with all associated navigational objects? I understand that I can chain the .Include() to load them, but this way of coding is not scalable. There has to be a better way to load a particular object fully. In my example above, if a Question object has answers, aaa abd bbb navigational properties, is there a way in EF to tell the object to do a full load of all associated properties? Thanks Nikhil

  • Anonymous
    July 26, 2011
    @Nikhil: Use lazy loading. It will get you into trouble when your application needs to handle a reasonable amount of load though. I don't know why you state that the .Include() way of coding is not scalable. This is not true, it keeps you in control of all the unneeded data that would otherwise cause unneeded database traffic.

  • Anonymous
    July 27, 2011
    Has referencing non-scalar variables been solved in this release? msdn.microsoft.com/.../bb896317.aspx

  • Anonymous
    August 10, 2011
    How can I take advantage of EF Codefirst on a WCF app that being consumed in a WPF application. I guess what I want is something closer to DbDomainService doing in the latest Silverlight RIA Services, but can I use that in a typical WPF app so that this DbDomainService take care of the EF changes back to the DB? I am also seeing some hints on using WCF DataServices exposing DbContext. But I couldnt locate any proper sample or reference. So the idea is to pass the DbCotext as a DomainService to the client side to make the Entity changes reflected back to DB easily.

  • Anonymous
    August 10, 2011
    Henk, We have confirmed that the improvement doesn't kick in if you have an abstract type and filed a bug on it. Thanks a lot for reporting this!

  • Anonymous
    August 15, 2011
    @Diego: Thanks for looking into this.

  • Anonymous
    August 21, 2011
    Can someone post sample code / database using entities that have enums? I can't for the life of me get the enums to show up in the database and I would love to compare my config files, sql connections, included references, etc.. to a working sample project.

  • Anonymous
    August 23, 2011
    @Acaz: EF support for enums enables having enums in your model (e.g. your classes), but it doesn't add enum support to the database if the database doesn't have it. In fact, with the current level of support in the CTP (and what we plan to have in RTM), enum properties can be mapped to database columns of any integer type supported by the EF.

  • Anonymous
    August 26, 2011
    when we can expect some info/post about caching and batching in EF vNext?

  • Anonymous
    August 27, 2011
    when can see  we this in code first, wcf ria, silverlight?? Thanks    

  • Anonymous
    August 28, 2011
    I've tried using .Any with the June 2011 CTP as the targeted framework on my EF but still got back NotSupportedException (The method 'Any' is not supported.) I have Microsoft.Data.Services.dll and Microsoft.Data.Services.Client.dll on the references list on the project. What else could I have missed?

  • Anonymous
    August 30, 2011
    Thanks Diego, but my problem is that my enum properties defined in my code-first model are not created in my Sql Server 2008 during the db.Database.CreateIfNotExists(); process. For example, the column "SendHomeworkReminders" does not show up in the Courses table.    [Table("Courses")]    public class course    {      public int Id { get; set; }      public MyEnums.SendReminder SendHomeworkReminders { get; set; }     ...  } And if the table is nothing but enums, a seemingly unrelated exception is thrown during the creation process.

  • Anonymous
    September 04, 2011
    I also suggest reading the "C# and Auto-Compiled LINQ Queries" from the following blog: blog.csharplearners.com/.../linq Dese the second level cashing improves the perfomance of the auto-compiled LINQ queries?

  • Anonymous
    September 11, 2011
    @Diego, I found the error! Enums will NOT work if they are declared within a class! All enums must be declared within a namespace only!!!

  • Anonymous
    September 27, 2011
    The comment has been removed

  • Anonymous
    September 28, 2011
    EF June 2011 CTP EF 4.2 Beta 1 EF Code First Migrations Alpha 3 And whatever work is going to add async support provided by .NET 4.5 This is getting out of hand.

  • Anonymous
    December 01, 2011
    I really hope the RTM comes out soon.  We could really use that table valued function support.

  • Anonymous
    December 21, 2011

  1. How about better support for different Schemas??????  Some sort of way to have a entity have a prefix naming scheme depending on what schema it is in?
  2. When you do a update and a column becomes nullable? The "update model from database" wizard in Visual Studio will update the SSDL, but will not keep the CSDL in sync with the SSDL.  Look here: social.msdn.microsoft.com/.../45101c23-591d-4a34-80cf-9aaae7b1176e
  3. In the Designer will you be able to move properties up and down in each entity?
  4. Why does the designer automatically zooms me out if I copy alot of properties into a entity.  That is so annoying.  Because I then have to zoom back in to where I was before.  And when I do zoom back in the entity I was looking at is either way to the right or way to the left and then I need to scroll that direction to view it again.
  5. I really hope the sql generation will be improved quite a bit because performance when querying a database is pretty abysmal.   When will this be out????
  • Anonymous
    February 29, 2012
    I failed to change My project's target framework to "Microsoft Entity Framework June 2011 CTP".It threw a Exception:" To Run This application.You first must install .NetFramework,vesion= 4.2  ".where I can get .Net 4.2?

  • Anonymous
    February 29, 2012
    @fripSide - you need to change your project target to CTP. In reality there is no .NetFramework 4.2 - we needed to work around some techincal issue. But the best thing you can do now is just to get Visual Studio 2011 that released today and use EF 5 that contains all the features we shipped in the June Ctp and more. See this post for more details: blogs.msdn.com/.../ef4-3-1-and-ef5-beta-1-available-on-nuget.aspx

  • Anonymous
    November 20, 2012
    The comment has been removed

  • Anonymous
    November 20, 2012
    @Chill beer - This is an old preview that shouldn't be used any longer. There are detailed uninstall instructions in the blog post as well as a header pointing to information on the latest release.

  • Anonymous
    June 06, 2013
    The comment has been removed

  • Anonymous
    June 06, 2013
    Have you tried repairing your VS or reapplying the service pack?

  • Anonymous
    June 06, 2013
    I didn't try repairing. Reapplying SP1 did not fix the issue.

  • Anonymous
    June 12, 2013
    Well, repairing the Visual Studio didn't fix it either.

  • Anonymous
    June 14, 2013
    @SlimShaggy when you tried reapplying the service pack it said that the product was not installed. Did you have SP1 installed before installing June CTP? If not, maybe you could just try installing the SP1 in a normal way instead of using the command above?

  • Anonymous
    June 15, 2013
    Yes, I did have SP1 installed. I installed it again "the normal way", but still it didn't resolve the issue.