共用方式為


Entity Framework Links #5

This is the fifth post in a regular series to recap interesting articles, posts and other happenings in the EF world.

 

The latest release

We recently made EF6 Release Candidate available. This is the last pre-release of EF6 before we RTM with Visual Studio 2013 later this year.

If you’re wondering why we can’t always give you exact dates for EF releases, Arthur Vickers put together a great post titled ‘ EF6 release dates…or lack thereof’.

Presentations

Glenn Condron and Rowan Miller from the EF team presented EF6 sessions at TechEd North America (Rowan) and TechEd Europe (Glenn). You can get the source code from the demos off Rowan’s blog. 

Glenn and Rowan also spent some time with Robert Green on VS Toolbox talking about EF5 and EF6. The session has lots of demos and you can grab the source code from the demos off Rowan’s blog.

Rowan had a short interview with Robert Green about EF6 on Chanel 9 at TechEd North America.

 

EF6 Features

We saw some great new content about the new features in EF6:

 

Arthur Vickers addressed the common confusion around Database initializer and Migrations Seed methods.

Julie Lerman blogged about Private Constructors and Private Setters and Entity Framework Power Tool Tips to View Model (A Feature I Depend On!).

Richard Broida wrote about using Entity Framework with F# and Windows Azure.

Rowan Miller covered Running EF T4 Code Generation Templates from Command Line and how to deal with the following error introduced in VS2012 Update 1 - Processor named ‘T4VSHost’ could not be found for the directive named ‘CleanupBehavior’.

Brian Sullivan blogged about Entity Framework Code-First Performance Issue with String Queries.

Comments

  • Anonymous
    September 17, 2013
    Will the EntityObject Code Generation Template be available prior to RTM or only at launch?  We currently rely on customizations and usage of ObjectContext.  Upgrading without isn't an option ATM.

  • Anonymous
    September 18, 2013
    @Paul M - We're about to update them now, they should be published before RTM.

  • Anonymous
    September 18, 2013
    Does anyone know if the database to model generation has improved in terms of speed in EF 6? I have a database that has about 1,500 tables in it and I think it takes hours (let it run overnight) to generate the model from the database. Also, the designer seems to maybe not be able to open or takes a long time to open as well. I know this is a ridiculous amount of tables. It's an existing database that I'm attempting to work with.

  • Anonymous
    September 19, 2013
    @Jon - some of the changes introduced in the EF6 designer should result in performance improvements. Opening large models should be faster as well. I don't have exact numbers but with your database you should be able to see the difference. Give it a try - the EF6 designer supports both EF5 and EF6 on both VS2012 and VS2013. For VS2012 it is a standalone msi that replaces existing EF tooling. In the worst case (there is a bug in RC that might block you connect.microsoft.com/.../cannot-load-mymodel-edmx-specified-cast-is-not-valid-when-clicking-edmx-file-in-project) you can unistall it and go back to the original EF Designer that shipped with VS2012.

  • Anonymous
    September 19, 2013
    I'm in the process of writing an app that will reverse engineer a database and generate Entity Framework code first classes (and use attributes rather than the fluent API like Microsoft's tool does). I have it roughly working with MySQL using DbConnection.GetSchema(). However, when I tried using it against SQL Server, I realized that the "Schema Collections" vary from one DBMS to another. Does anyone know if there is a DBMS-independent way of getting schema information using ADO.NET? There does seem to even be a common way to determine the primary keys for a table.

  • Anonymous
    September 19, 2013
    The comment has been removed

  • Anonymous
    September 19, 2013
    The comment has been removed

  • Anonymous
    September 19, 2013
    Interestingly, I just noticed that the Power Tools Beta 3 that I installed this morning is already using EF 6. I just tried using the library that I created with it in an EF 5 app and it's giving me a versioning error. Not sure if I can downgrade that to EF 5 or not.

  • Anonymous
    September 19, 2013
    @Jon - The power tools just installs the latest package from NuGet. You are safe to downgrade to the EF5 package.

  • Anonymous
    September 19, 2013
    I think I found out why the Power Tools use the fluent API instead of attributes. I have a database that has a table that has 3 columns in it's primary key (existing database, I wouldn't have designed it that way myself). Then, there's another table that has two foreign keys referencing the first table. Two of the foreign key columns in the second table overlap. Therefore, you would need to add two ForeignKey attributes to a given property. However, that isn't supported. The fluent API code appears to handle this.

  • Anonymous
    September 23, 2013
    @Jon - Yes, there are certainly scenarios where you would need to fall back to the Fluent API.

  • Anonymous
    September 24, 2013
    Does anyone know if EF 6 will work with MySQL? I just upgraded to EF 6, but, it's unable to load the MySQL driver. I'm using version 6.6.5 of the driver as I've had issues with the newer driver.

  • Anonymous
    October 01, 2013
    @Jon - I haven't seen anything yet but it sounds like it will be worked on in the near future - forums.mysql.com/read.php.