Partilhar via


EF 4.2 Beta 1 Available

 


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.


 

We recently posted about our plans to rationalize how we name, distribute and talk about releases.  We heard a resounding ‘Yes’ from you so then we posted about our plans for releasing EF 4.2. Today we are making EF 4.2 Beta 1 available.

 

EF 4.2 = Bug Fix + Semantic Versioning

When we released ‘EF 4.1 Update 1’ we introduced a bug that affects third party EF providers using a generic class for their provider factory implementation, things such as WrappingProviderFactory<TProvider>. We missed this during our testing and it was reported by some of our provider writers after we had shipped. If you hit this bug you will get a FileLoadException stating “The given assembly name or codebase was invalid”. This bug is blocking some third party providers from working with ‘EF 4.1 Update 1’ and the only workaround for folks using an affected provider is to ask them to remain on EF 4.1. So, we will be shipping this version to fix it, this will be the only change between ‘EF 4.1 Update 1’ and ‘EF 4.2’. Obviously a single bug fix wouldn’t normally warrant bumping the minor version, but we also wanted to take the opportunity to get onto the semantic versioning path rather than calling the release ‘EF 4.1 Update 2’.

 

Getting EF 4.2 Beta 1

The Beta is available via NuGet as the EntityFramework.Preview package.

If you already have the EntityFramework package installed then installing the Beta will overwrite the existing reference in your project. If you used the standalone installer for ‘EF 4.1’ or ‘EF 4.1 Update 1’ there is no need to uninstall.

 

Templates for Model First & Database First

The templates for using DbContext with Database First or Model First are now available on Visual Studio Gallery, rather than in a standalone installer.

Note: The templates for C# and VB.NET applications (including ASP.Net Web Applications, MVC, etc.) are available. The templates for ‘Web Sites’ will be available soon.

Right Click on the designer surface and select ‘Add Code Generation Item…’:

AddCodeGenerationItem

Select ‘Online Templates’ from the left menu and search for DbContext:

AddDbContextTemplate

 

Support

This is a preview of a future release and is designed to allow you to provide feedback. It is not intended or licensed for use in production. If you need assistance we have an Entity Framework Pre-Release Forum.

 

What’s Not in This Release?

As covered earlier this release is just a small update to the DbContext & Code First runtime. The features that were included in EF June 2011 CTP are part of the core Entity Framework runtime and will ship at a later date. Our Code First Migrations work is continuing and we are working to get the next alpha in your hands soon.

 

ADO.NET Entity Framework Team

License.rtf

Comments

  • Anonymous
    August 22, 2011
    This product is getting better an better everytime you publish a blog article. Publish more!

  • Anonymous
    August 22, 2011
    We really need the speed improvements from the query caching in the June 2011 CTP before Entity Framework can be put in a production environment. I'm rather disappointed they're not in this release and that no indication of when they'll be included has been provided.

  • Anonymous
    August 22, 2011
    Does anyone have a working June 2011 CTP solution using Enums with sample code / database? I still can't get enums to show up in the database

  • Anonymous
    August 22, 2011
    What's your priority to map a private field? This is one of my issues that make me to use NHibernate instead of EF. Or is there some other technique that you suggest in this - common - domain scenario: public class Order {    private IList<OrderLine> itens;    public void AddLine(OrderLine item) { }    public IEnumerable<OrderLine> OrderLines { get { return itens; } } }

  • Anonymous
    August 22, 2011
    Keep up the good work. Looks like you are working on a number 5 version on all levels :)

  • Anonymous
    August 22, 2011
    The comment has been removed

  • Anonymous
    August 23, 2011
    The best/important thing about this update is its name!!

  • Anonymous
    August 23, 2011
    I do face same issue with 4.2 beta 1 while using third party EF providers, Do I need to add/modify anything in my project? the same is working fine with EF 4.1 RTW

  • Anonymous
    August 24, 2011
    The comment has been removed

  • Anonymous
    August 24, 2011
    The comment has been removed

  • Anonymous
    August 24, 2011
    Please give us the ability to perform a pessimistic db.Set<T>.Insert(object) which will not add related entities and simply INSERT the scalar column mapped properties and update key info only.  This issue prevents a large community of existing POCO users to simply add an object graph where it is expected, hence pessimistic that the related entities already exist in the database and we don't want duplicate cacade inserts, please!  4.3 ?  thanks  

  • Anonymous
    August 24, 2011
    @Rowan Miller, Hi, Its working when I explicitly added "Persist Security Info=True" to my connection string(I am connecting to Oracle). I am also able to work with 4.1 Update 1. But EF 4.1 RTW doesn't need this!.

  • Anonymous
    August 25, 2011
    When updating a client that may not have installed EF 4.1, are there any files that need to be redistributed from the development environment?

  • Anonymous
    August 31, 2011
    Keep up with these great quick updates. I can't wait until spatial moves from CTP to full release!

  • Anonymous
    August 31, 2011
    First, good work! We really like where Entity Framework is going.  In regards to "migration", it makes sense (especially for simple applications or applications developed in small controlled environments) to make it simple for a developer to publish application changes (including Model changes with or without data manipulation) to a production server and have it just work.  If we add a column, re-scaffold or modify views, and publish, why should we (in our simple environment) have to switch over to writing Transact-SQL scripts?   With that said, we are "live" and running our application in a production environment and everything works perfectly.  Now we have made a simple model change, adding a property, and need to add the field to the database; which led us to all of these conversations.  So the "migration" solution is perfect for our needs.   However, we need to update the schema on our hosted environment's SQL Server now. Before going "live" it was a snap.  Simply use publish using Web Deploy in Visual Studio after ensuring the checkbox "Include all databases configured in Package/Publish SQL tab" is checked.  Of course we have the finer details included to "DropCreateDatabaseIfModelChanges" and override the "Seed" to put some data into the database.  Any test data, of course, is toast--but no big deal.   Now it is a big deal.  So, we patiently wait for "migration".  In the meantime, we just want to make sure we are going to accomplish this latest update to the application (the adding of a property and hence a field) the correct way.  We believe we should:

  1. In the Package/Publish Web, leave the "Include all databases configured in Package/Publish SQL tab" checked.
  2. In the Package/Publish SQL tab, select "Schema Only" for "Database scripting options".
  3. Include a custom SQL script to "ALTER" the table adding the field.
  4. Uncheck the "[Auto-generated Schema Only]" script. Or, remote into the SQL Server and add the field manually, or run the script on the server. Fantastic work once again, Sean Kelly
  • Anonymous
    August 31, 2011
    Hi all, Great job so far, it's awesome! How about redistribution? How do we package the EF 4.1+  bits for our customers? E.F 4.4 was part of FX 4.0, so we had no distro issues. Thx in advance for your recommendations!

  • Anonymous
    August 31, 2011
    Sorry, I meant "E.F 4.0 was part of FX 4.0" above :)

  • Anonymous
    September 04, 2011
    @Sean Kelly Step 4) Ucheck the "[Auto-generated Schema Only]" script will uncheck "Pull data and/or schema from an existing database.  So, that technique will NOT work.  It seems you'll have to remote into your Development SQL Server and manually add the field or run the script.  At least until the Auto-Magic Migration feature is developed.

  • Anonymous
    September 05, 2011
    Are you guys going to have a corresponding POCO generator for this version of EF that's going to make code portability a reality? The 4.1 version pretty much renders the Portable Library Tools useless because of the use of HashSet in the entity class definitions.

  • Anonymous
    September 19, 2011
    I have been trying, without success, to work out the details that will allow me to use Sql Azure Spatial table columns such as Geography with EF. I had downloaded the EF June CTP version and installed that, but then I was not able to deploy my MVC 3 application to Azure because of the strange 4.2 version that came from having to select the June CTP .NET framework in my project settings. I am hoping that this EF 4.2 Beta version will allow me to simply use the newer .DLLs without needing to do this (which confuses the Azure deploy tool).

  • Anonymous
    October 06, 2011
    guys, I have VS 11 dev preview installed on my machine and I cannot work with database first as you indicated above. the below template is cannot be installed into VS 11 dev. preview : visualstudiogallery.msdn.microsoft.com/7812b04c-db36-4817-8a84-e73c452410a2 What is the way of working with those on VS 11 dev. preview?