Partager via


EF 6.1.0 Beta 1 Available

Since the release of EF6 our team has started working on the EF6.1 release. This is our next release that will include new features.

 

What’s in Beta 1?

Entity Framework 6.1 is a minor update to Entity Framework 6 and includes a number of bug fixes and new features. The new features in this release include:

  • Tooling consolidation provides a consistent way to create a new EF model. This feature extends the ADO.NET Entity Data Model wizard to support creating Code First models, including reverse engineering from an existing database. These features were previously available in Beta quality in the EF Power Tools.
  • Handling of transaction commit failures provides the new System.Data.Entity.Infrastructure.CommitFailureHandler which makes use of the newly introduced ability to intercept transaction operations. The CommitFailureHandler allows automatic recovery from connection failures whilst committing a transaction.
  • IndexAttribute allows indexes to be specified by placing an [Index] attribute on a property (or properties) in your Code First model. Code First will then create a corresponding index in the database.
  • The public mapping API provides access to the information EF has on how properties and types are mapped to columns and tables in the database. In past releases this API was internal.
  • Ability to configure interceptors via the App/Web.config file (allowing interceptors to be added without recompiling the application).
  • Migrations model change detection has been improved so that scaffolded migrations are more accurate; performance of the change detection process has also been greatly enhanced.
  • Performance improvements including reduced database operations during initialization, optimizations for null equality comparison in LINQ queries, faster view generation (model creation) in more scenarios, and more efficient materialization of tracked entities with multiple associations.

 

Where do I get the beta?

The runtime is available on NuGet. Follow the instructions on our Get It page for installing the latest pre-release version of Entity Framework runtime.

The tooling for Visual Studio 2012 and 2013 is available on the Microsoft Download Center.

 

Support

This is a preview of features that will be available in the final release of EF6.1 and is designed to allow you to try out the new features and report any issues you encounter. Microsoft does not guarantee any level of support on this release.

If you need assistance using the new features, please post questions on Stack Overflow using the entity-framework tag.

 

Thank you to our contributors

We’d like to say thank you to folks from the community who contributed features, bug fixes, and other changes to the 6.1 release - RogerAlsing, ErikEJ, and mikecole.

In particular, we’d like to call out the following contributions:

  • Support for String.Concat and .ToString in LINQ queries (RogerAlsing)
  • Support for enum HasFlags method in LINQ queries (RogerAlsing)
  • Entity SQL canonical function support for SQL Server Compact (ErikEJ)
  • Fix for a bug that was affecting EF running under Mono (ErikEJ)

 

What’s next?

All the features we plan to include in the final release of EF6.1 are included in this Beta. At this stage our team is tidying up a few things with the new features and fixing any high priority bugs that are reported.

Comments

  • Anonymous
    February 11, 2014
    The comment has been removed

  • Anonymous
    February 11, 2014
    Finally... We have support for Unique indexes.

  • Anonymous
    February 11, 2014
    Excellent news! I've been waiting for interceptors to be able to be added without rebuilding. Great work.

  • Anonymous
    February 11, 2014
    One question tho, With support for indexes, Can we map relations based on non primary unique keys using fluent api or annotation?

  • Anonymous
    February 11, 2014
    Does the IndexAttribute support unique indexes or just indexes in general? In other words, can I create relationships that reference unique indexes/keys other than the entity's primary key?

  • Anonymous
    February 11, 2014
    @Mike: using the new Index attribute, you can use [Index(IsUnique = true)] to specify unique indexes, But I can't figure out the correct fluent api syntax to create such relationship.

  • Anonymous
    February 11, 2014
    will we get the symbols/source files during debugging our applications for EF6.1?

  • Anonymous
    February 11, 2014
    @Mike & @KaymarP Information about the current fluent API for indexes appears to be available here:  entityframework.codeplex.com/.../1969

  • Anonymous
    February 12, 2014
    @Mike & @KaymarP - Unfortunately you can still only use primary keys as the target of relationships. We do want to lift this limitation but it is a very large amount of work (just because of the way EF is implemented).

  • Anonymous
    February 12, 2014
    @Andre.Ziegler - We were blocked by some issues with SymbolSource, we'll follow up again to see if we can get the issues resolved.

  • Anonymous
    February 12, 2014
    What kind of optimizations for null was done? Thx

  • Anonymous
    February 12, 2014
    @Felipe Fujiy - We improved the mechanism of handling equality comparisons between potentially nullable operands when UseDatabaseNullSemantics is false (default), with the goal of producing simpler query expression trees. Some information and links to related issues can be found at: entityframework.codeplex.com/.../1598 Primarily we were able to reduce significantly the expression trees for complex queries that involve equality comparisons, as exemplified in: entityframework.codeplex.com/.../1579 Basically, EF expands an equality comparison to an expression that handles 3-valued logic. The previous implementation did not provide a consistent and optimal way of generating these expressions, resulting in unnecessary terms that impacted the query performance, for example, as described in: entityframework.codeplex.com/.../1783 With the improved functionality, the expressions generated for equality comparisons should include only the minimal terms necessary to account for NULLs, depending on the context in the query and the type of operands.

  • Anonymous
    February 12, 2014
    One of the ORM's job is make DB abstraction, for application developer, he might just want to program against entities. If index attribute exists, should the developer care about if the index is cluster or non-cluster? I don't think bring more and more db concept into EF is a good idea. Thanks. Weijie

  • Anonymous
    February 12, 2014
    Hi guys, great work on the ongoing performance improvements (which are much necessary btw!) Can you elaborate on what you mean by "reduced database operations during initialization" and "faster view generation (model creation) in more scenarios"? ie: Which scenarios is view generation improved for and what kind of scenarios do the reduced database operations during initialization affect? Thanks!

  • Anonymous
    February 13, 2014
    This kind of null param query was optimized too? int a = 3; int? b = 3; context.Request.Where(x => x.IdFloorNullAble == 3).Select(x=> 1).ToList(); //1 context.Request.Where(x => x.IdFloorNullAble == a).Select(x=> 1).ToList(); //2 context.Request.Where(x => x.IdFloorNullAble == b).Select(x=> 1).ToList(); //3 context.Request.Where(x => x.IdContactNotNull == 3).Select(x=> 1).ToList(); //4 context.Request.Where(x => x.IdContactNotNull == a).Select(x=> 1).ToList(); //5 context.Request.Where(x => x.IdContactNotNull == b).Select(x=> 1).ToList(); //6 #1 SELECT 1 AS [C1] FROM   [dbo].[Request] AS [Extent1] WHERE  (3 = [Extent1].[IdFloorNullAble])       AND ([Extent1].[IdFloorNullAble] IS NOT NULL) #2 SELECT 1 AS [C1] FROM   [dbo].[Request] AS [Extent1] WHERE  (([Extent1].[IdFloorNullAble] = 3 /* @p__linq__0 /)        AND (NOT ([Extent1].[IdFloorNullAble] IS NULL                   OR 3 / @p__linq__0 / IS NULL)))        OR (([Extent1].[IdFloorNullAble] IS NULL)            AND (3 / @p__linq__0 / IS NULL)) #3 SELECT 1 AS [C1] FROM   [dbo].[Request] AS [Extent1] WHERE  (([Extent1].[IdFloorNullAble] = 3 / @p__linq__0 /)        AND (NOT ([Extent1].[IdFloorNullAble] IS NULL                   OR 3 / @p__linq__0 / IS NULL)))        OR (([Extent1].[IdFloorNullAble] IS NULL)            AND (3 / @p__linq__0 / IS NULL)) #4 SELECT 1 AS [C1] FROM   [dbo].[Request] AS [Extent1] WHERE  3 = [Extent1].[IdContactNotNull] #5 SELECT 1 AS [C1] FROM   [dbo].[Request] AS [Extent1] WHERE  ([Extent1].[IdContactNotNull] = 3 / @p__linq__0 /)       AND (3 / @p__linq__0 / IS NOT NULL) #6 SELECT 1 AS [C1] FROM   [dbo].[Request] AS [Extent1] WHERE  ([Extent1].[IdContactNotNull] = 3 / @p__linq__0 /)       AND (3 / @p__linq__0 */ IS NOT NULL) Just the 4th query was fully optimized. But I was expecting that #1, #2 and #5 was too

  • Anonymous
    February 13, 2014
    The comment has been removed

  • Anonymous
    February 14, 2014
    @Felipe Fujiy - We'll continue discussing this one of the issue you opened - entityframework.codeplex.com/.../2083.

  • Anonymous
    February 14, 2014
    @Weijie JIN - I agree that we don't want to try and allow modelling every database concept in EF. In particular, we definitely don't want folks to have to pollute their entity classes with database related attributes. For that reason, you can also specify indexes in the Fluent API. And of course, if you don't want the index in your EF model at all, you can just add them in the migrations layer (but then migration scaffolding won't be aware of them so you'll need to take care of updating/dropping them as needed). We added Index attribute because a lot of people were asking for it, but it's definitely not the only way to add indexes (just a convenient one).

  • Anonymous
    February 14, 2014
    @Jon - Could you open a work item and include some code to reproduce the issue? We definitely want to dig into this one ASAP if it's a new issue in 6.1 - entityframework.codeplex.com/.../Create.

  • Anonymous
    February 14, 2014
    "FuncionallyImportedToStoreProcedurally - changes enabling native support for TVFs and sprocs (implicit result mapping only) with Code First" I saw this entry in your codeplex source-history. Is there any documentation about implementing TVF?

  • Anonymous
    February 15, 2014
    @rafe - Please see this thread:  entityframework.codeplex.com/.../494365 and this project:  codefirstfunctions.codeplex.com (note that this is work in progress but is in usable state right now)

  • Anonymous
    February 15, 2014
    great work.  Quick question.  With the release of [Index(IsClustered=true)], how do we prevent the [Key] attribute from creating the clustered index?   Not seeing how to use the IsClustered=true without removing the clustered index that [Key] created.

  • Anonymous
    February 18, 2014
    I can't seem to get the extended features of the Data Model wizard.  

  • Anonymous
    February 19, 2014
    I agree with Cragun, what about the clustered index?

  • Anonymous
    February 19, 2014
    @AndyW - Did you install the tooling from the download center link? www.microsoft.com/.../details.aspx You'll need to restart VS after installing it.

  • Anonymous
    February 19, 2014
    @Cragun  & @redfearnk - At this stage you need to make the primary key index non-clustered by editing migration code. You could either do this by editing the scaffolded migration that creates the table to specify 'clustered = false' in the Index call for the primary key, or by manually adding code to change the index in a later migration. In the future we may allow you to add an Index attribute to the key property to change the index that gets generated by default.

  • Anonymous
    February 24, 2014
    @Marcel Bradea - Database operations during initialization happen when EF is interacting with the __MigrationsHistory table etc. to work out the current state of your database. We reduced the number of queries sent to the database during this process. Regarding performance improvements, we made a couple of tweaks to view generation that help some models. Whether the changes help is entirely dependent on the patterns in your model and there are no simple rule about shapes of the model that will benefit. If you are interested, here are the two main changes entityframework.codeplex.com/.../dff658791f7a2a592c61db87e2ee610d548aef84 and entityframework.codeplex.com/.../a541add6f89260975a59dbe79fecc951e0ca547b.

  • Anonymous
    February 26, 2014
    (This is a feature request.)  I am having difficulty embedding XML comments into the code generated by my EDMX file.  (See stackoverflow.com/.../entityframework-t4-template-xml-documentation .)  I have already written an app to update the EDMX <documentation> elements from an XML file (a simplified database dictionary) of my design, but the T4 template omits them.  I am considering writing an app (maybe using RegEx expressions) to update the generated *.tt files, but perhaps a change to the EF6.Utility.CS.ttinclude file would be simpler.  Even better would be an update to the EF that would include each <#= edmProperty.Documentation.Summary #> as an XML comment <summary> element and each <#= edmProperty.Documentation.LongDescription #> as an XML comment <remarks> element.  Is any such update in the works?  A corresponding mechanism for including the comments, in some meaningful way, in the generated SQL code would also be welcome, but for me the C# code is more important.  If no such update is planned, it would help to have info on how to securely/effectively modify the *.tt files or EF6.Utility.CS.ttinclude -- I want to be able to automatically copy comments to as great a variety of entities as is practicable.  (Or at least to all those corresponding to tables and fields.)

  • Anonymous
    February 27, 2014
    Is there a plan to support batch update/delete?

  • Anonymous
    February 28, 2014
    @Tat Sean - It's on our backlog, but we don't have a specific release that we are planning to implement it in as yet entityframework.codeplex.com/.../53.

  • Anonymous
    February 28, 2014
    Regarding batch update, I'm needing that feature badly as well. Overall, I think EF is great, but, this is one area where it is really lacking. I'm thinking that if EF at least used prepared commands, it would improve update speed a lot. I think that would be easier to implement that batching of commands. Also, if there was a Clear() method to clear the session cache, that would help a lot. You need to be able to keep the number of objects that are being tracked to a reasonable level to keep the performance and memory use reasonable.

  • Anonymous
    March 03, 2014
    @Jon - Would the Clear method be any better than just creating a new instance of the context? We intentionally make it inexpensive to create contexts... so it's probably actually faster to create new one rather than going thru the logic to reset the change tracker.

  • Anonymous
    March 03, 2014
    Hi, how can I use IndexAttribute inside EntityTypeConfiguration ?? I need to configure an index with multiple columns, where not all columns exists in the same class (some exists in a base class e.g. my "TenantId" Column) class ContactTypeConfiguration : EntityTypeConfiguration<ContactType> { public ContactTypeConfiguration() { this.Property(p => p.TenantId).HasColumnAnnotation("Index", new IndexAttribute("IX_TenantId_Name", 1)); this.Property(p => p.Name).HasColumnAnnotation("Index", new IndexAttribute("IX_TenantId_Name", 2)); } } IndexAttribute doesn't help here.. Regards, Daniel

  • Anonymous
    March 03, 2014
    My attempt with EntityTypeConfiguration ends up with an error: "An object of type 'IndexAttribute' cannot be serialized by the IndexAnnotationSerializer. Only 'IndexAnnotation' objects can be serialized."

  • Anonymous
    March 03, 2014
    @daniel.schmitz - There are details on how to currently specify Index from the Fluent API in this work item - entityframework.codeplex.com/.../1969. Alternatively you can just add them in a migration (by adding a call to the AddIndex method). If you use the Migration option, they won't be part of the model, so you'd have to also manually add code to alter/drop them if you change parts of the model that require that in the future.

  • Anonymous
    March 03, 2014
    @Vincent Johns - We have an item tracking this on our backlog that you can follow and/or vote on - entityframework.codeplex.com/.../1921. We're not 100% certain that we want to do it in the default template as we try to keep those as simple as possible, but we may.

  • Anonymous
    March 03, 2014
    @Rowan I'm happy to create a new instance of the DbContext. However, when I tried it, it was slow. But, that was a long time ago and I know it was supposed to be sped up now. Another issue that I ran into is that the database-first code generator doesn't make all the properties on an entity virtual. So, change tracking is even worse unless you go in and change that. I know you're supposed to be able to modify the templates, but, I never did figure out where I needed to make the change. It would be nice if the GUI had a checkbox where you could specify whether you want to enable change tracking proxies. Without them, it is too slow and uses too much memory. For batch updates in EF, I gave up. I now have my own code generator that creates CRUD methods that uses prepared commands. I would have much preferred to simply use EF, but, it was too slow.

  • Anonymous
    March 03, 2014
    Many thanks Rowan, your link help me much!

  • Anonymous
    March 03, 2014
    @Rowan -- Concerning support for XML comments, thanks.  I know that some people feel that they clutter the code.  For me, the XML comments are virtually my only code documentation, so they tend to be numerous and lengthy.  I know you want to keep things simple, for ease of maintenance, but might it make sense to publish 2 versions, one with XML comment support?  (EDMX in VS 2013 already offers 2 code-generation choices: Legacy and T4.)  Anyway, from what you posted, I think it makes sense to continue with what I'm doing, and when I think it's working well enough to be worth sharing, I'll post it.

  • Anonymous
    March 03, 2014
    The comment has been removed

  • Anonymous
    March 04, 2014
    @Vincent Johns - Yes, two templates is an option (or a switch in the main template). It's all just a matter of the number of requests Vs. the cost of maintaining the different versions of the templates (xml comments are not the only option folks as for). For the moment, progressing with your own version is the best option.

  • Anonymous
    March 04, 2014
    The comment has been removed

  • Anonymous
    March 04, 2014
    @Jenda - Work item is tracked here - entityframework.codeplex.com/.../1612. For the moment, you could use one of the raw SQL methods (ObjectContext.ExecuteStoreQuery, DbSet.SqlQuery, etc.) to run the stored procedure using SQL - those APIs have the option to not create a transaction.

  • Anonymous
    March 04, 2014
    The comment has been removed

  • Anonymous
    March 05, 2014
    @Rowan - Thanks! I've modified the code generation template quite a bit already and made an associated VS plugin adding plenty of properties to most objects in the edmx so I'd actually prefer a new overload as this would let me specify whether to wrap in transaction or not in the edmx on the function level with the default of my choice, but I understand that it's not a solution for everyone. A global or ObjectContext level setting is absolutely fine. Thanks again!

  • Anonymous
    March 05, 2014
    how can we achieve the following statement using EF LINQ? Insert Into [TableName] (a, b, c) Values (Select Max(a) From [TableName], 1, 2)

  • Anonymous
    March 06, 2014
    @SubQuery in Insert with EF - You can't get EF to natively generate that SQL at the moment. The easiest option would be to introduce a stored procedure and map to that (Code First - http://msdn.com/data/dn468673 EF Designer - http://msdn.com/data/jj593489). You could also look at tweaking the generated SQL before it's sent to the database using command interception (msdn.com/.../dn469464) but you'd be doing string manipulation on the query, so it would be pretty messy.

  • Anonymous
    March 06, 2014
    @CodeMonkey - We have included a mechanism to customize the code generation templates (same as you used to be able to in the EF Power Tools) but we haven't published the templates just yet. When we do, you'll be able to add the templates to your project (probably as a NuGet package) and then customize the T4 templates used to generate the code.

  • Anonymous
    March 10, 2014
    Do you plan to implement the api for creating indexes that is suggested by zlangner here: entityframework.codeplex.com/.../1969

  • Anonymous
    March 12, 2014
    @Sam Wheat - No definite plans for our team to do this in the immediate future... it would make a nice pull request though :)

  • Anonymous
    March 17, 2014
    The comment has been removed

  • Anonymous
    March 20, 2014
    Great work with 6.1! Just wondering when you are expecting to release an RTM for 6.1? Cheers

  • Anonymous
    March 20, 2014
    @Tat Sean - You need to set the Result property on the DbCommandInterceptionContext. @Matt D - It's out now blogs.msdn.com/.../ef6-1-0-rtm-available.aspx.

  • Anonymous
    March 20, 2014
    @Rowan Miller Thanks! I was checking the codeplex EF releases RSS feed and didn't see it there :) Great work!

  • Anonymous
    August 21, 2014
    The comment has been removed

  • Anonymous
    August 22, 2014
    The comment has been removed