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.
Back in April we announced the release of Entity Framework 4.1 (EF 4.1), today we are releasing Entity Framework 4.1 – Update 1. This is a refresh of the EF 4.1 release that includes a small number of bug fixes and some new types to support the upcoming migrations preview.
What’s in Update 1?
Update 1 includes a small set of changes including:
- Bug fix to remove the need to specify ‘Persist Security Info=True’ in the connection string when using SQL authentication. In the EF 4.1 release ‘Persist Security Info’ was required for Code First to be able to create a database for a connection using SQL Authentication. The update includes a fix to remove this requirement. Note that ‘Persist Security Info’ is still required if you construct a DbContext using a DbConnection instance that has already been opened and closed.
- Introduction of new types to facilitate design-time tools for Code First. Update 1 introduces a set of types to make it easier for design time tools to interact with derived DbContexts:
- DbContextInfo can be used to instantiate and interact with a derived context as well as determine information about the origin of the connection string etc..
- IDbContextFactory<TContext> is used to let DbContextInfo know how to construct derived DbContext types that do not expose a default constructor. If your context does not expose a default constructor then an implementation if IDbContextFactory should be included in the same assembly as your derived context type.
How Do I Get Update 1?
Entity Framework 4.1 – Update 1 is available in a couple of places:
- Download the stand alone installer
Note: This is a complete install of EF 4.1 and does not require a previous installation of the original EF 4.1 RTM. - Add or upgrade the ‘EntityFramework’ NuGet package
Note: If you have previously run the EF 4.1 stand alone installer you will need to upgrade or remove the installation before using the updated NuGet package. This is because the installer will add the EF 4.1 assembly to the Global Assembly Cache (GAC). When available the GAC’d version of the assembly will be used at runtime.
Note: The NuGet package only includes the EF 4.1 runtime and does not include the Visual Studio item templates for using DbContext with Model First and Database First development.
Getting Started with EF 4.1
There are a number of resources to help you get started with EF 4.1:
- ADO.NET Entity Framework page on the MSDN Data Developer Center
There is lots of great new content on this site, including ‘Getting Started’ videos for the new features in EF 4.1 - MSDN Documentation
- ADO.NET Entity Framework Forum
- Code First walkthrough
- Model First / Database First walkthrough
Support
This release can be used in a live operating environment subject to the terms in the License Terms. The ADO.NET Entity Framework Forum can be used for questions relating to this release.
ADO.NET Entity Framework Team
When will the release be ready with the SQL improvements? This update provides zero benefit to us. The SQL generation of EF is rediculously slow at the moment and the June 2011 CTP fixes the majority of our performance problem, but we can't put a CTP into a production environment.
Hell yeah..
When EntityFramework 4.1 will support the upcoming migrations, enums, etc… ?
You guys are awesome.. I love all updates… thanks so much.
How does it create the database and then reconnect to the new database without persisting the security info?
[)amien
Ah, probably now uses the "USE [database]" command – that was not supported on Azure when we developed CF originally.
[)amien
@Damien: we found that in the majority of cases it was our own code which was actually creating the connection objects based on an user provided connection string (e.g. from the .config file). In this update we just make sure that we create a separate connection object for things like database initialization. Then because the connection object has never gone through an Open()/Close() cycle before, the credentials will still be there as needed.
@Damien: we found that in the majority of cases it was our own code which was actually creating the connection objects based on an user provided connection string (e.g. from the .config file). In this update we just make sure that we create a separate connection object for things like database initialization. Then because the connection object has never gone through an Open()/Close() cycle before, the credentials will still be there as needed.
@Daniel and @Kim: Thanks for your questions. This is just a minor update to EF 4.1, which still builds on top of the core EF 4.0 bits (e.g. System.Data.Entity.dll, which is part of .NET 4.0).
The upcoming EF Migrations preview will work with this version, but the rest of the vNext features like enums, spatial and TVF support, query plan caching for LINQ and the SQL generation improvements you refer to require changes to the core EF bits and will take longer to release. Unfortunately I don’t have any specific dates that I can share at the moment.
Why are these packages never distributed in ZIP (or other archive) format for easy extraction?
The typical use case in my workplace is to have to install the package, locate and copy the relevant DLLs, and then uninstall again. A simple ZIP with the DLLs would save a lot of hassle 🙂
Hello, is there in this update any way to create unique keys with CF?
Hi,
After updgrading our project with this update (through Nuget) we are getting this System.IO.FileLoadException as soon as I execute the first query in my code.
Am I the only one getting this error?
Any help would be appreciated. Thanks.
Germán
### System.IO.FileLoadException ###
System.IO.FileLoadException: "El nombre de ensamblado o el código base dado no es válido. (Excepción de HRESULT: 0x80131047)"
en System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
en System.Reflection.AssemblyName..ctor(String assemblyName)
en System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection)
en System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
en System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
en System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
en System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
en System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
en System.Data.Entity.Internal.InternalContext.Initialize()
en System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
en System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
en System.Data.Entity.Internal.Linq.InternalSet`1.Include(String path)
en System.Data.Entity.Infrastructure.DbQuery`1.Include(String path)
en System.Data.Entity.DbExtensions.Include[T](IQueryable`1 source, String path)
en Kerala.Servicios.LuceneBuscadorService.AddViajesToIndex(IndexWriter writer) en D:ProyectosKeralasrcKerala.CoreServiciosBuscadorLuceneBuscadorService.cs:línea 257
en Kerala.Servicios.LuceneBuscadorService.ReconstruirIndexBuscador() en D:ProyectosKeralasrcKerala.CoreServiciosBuscadorLuceneBuscadorService.cs:línea 247
en Kerala.Servicios.LuceneBuscadorService.<Initialize>b__0(Object callback) en D:ProyectosKeralasrcKerala.CoreServiciosBuscadorLuceneBuscadorService.cs:línea 58
en System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
en System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
en System.Threading.ThreadPoolWorkQueue.Dispatch()
en System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Germán, we're not sure what could be causing this, but it might be related to the ADO.NET provider you're using. What database are you targeting, and what provider are you using?
Thanks,
David
When are Data Migrations coming? Please say soon.
@Juan Francisco: No, unique constraints are still not supported in EF.
@Juan Francisco: No, unique constraints are still not supported in EF.
Dear ADO.NET team,
In one of out project we would like to use Entity Framework.Before using we want to know the limitations.
Can you please answer below questions?
*Maximum how many tables it support.(If we import tables to Entity framework designer)
*Do i need to create more than one entity model if i have more than 300 tables
*How it support if my result set is dynamic
Hope i will get replay soon from you .
Thanks,
Srinivasa Rao.K
Why does Microsoft call some things Service Packs and other things just use version updates? And now we have "Update 1"? Why isn't this just called 4.1.1 or some such?
your product versioninig confuses me
I agree this is confusing – this has new public API, why isn't this just 4.2?
@Matt, have you tried the NuGet package? It's even easier than a compressed file format.
@Richard G, the initial drop was announced yesterday: blogs.msdn.com/…/code-first-migrations-august-2011-ctp-released.aspx
@Srinivasa, there isn't any hard limit on how many tables EF supports, but the designer will take a long time to load very large models. There are a number of designer improvements coming (currently in the CTP) that will help with this scenario. You don't necessarily need more than one model if you have more than 300 tables, but you should scope your model to include only the tables pertinent for that service/application. I'm not sure I understand the question about the dynamic result set, can you clarify?
@John/avc/Paul, duly noted. I think we could learn a lot from semantic versioning. It takes time to change course, however, so keep speaking up – there's still hope for us! 🙂
"@John/avc/Paul, duly noted. I think we could learn a lot from semantic versioning. It takes time to change course, however, so keep speaking up – there's still hope for us! :)"
What does that even mean? There is nothing to learn and you can start doing it today.
Please provide support for true asynchronous I/O (via IOCP not threads) in order to asynchronously execute queries against the database. Using the traditional async pattern with IAsyncResult and Begin/End methods would be a nice baseline, Task<T> would be icing on the cake. Also, it would be great to be able to provide custom column-mappings for raw text SQL queries into anonymous types. Thanks!
The requirements for Update 1 are:
Windows 7, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Vista
No more XP support or did you just forget to list it? 🙂
I could really use an update that officially includes support for the compiled queries. I tried the June 2011 CTP, but it did not work for me because it did not properly support the MySQL connector. Given how slow Entity Framework is at generating SQL, it is critical this release gets out at some point in the near future.
I performance benchmarked Entity Framework against raw ADO.NET (our original code), Open Access ORM and Entity Framework. Open Access was 4-5x slower than direct ADO.NET code. Entity Framework was another 4-5x slower again than Open Access, making it about 20x slower than ADO.NET code. Until these kinds of performance issues are resolved, Entity Framework is really just an interesting experiment.
German and David DeWinter, see this: weblogs.asp.net/…/entity-framework-v4-1-update-1-the-kill-the-tool-eco-system-version.aspx
When will we be able to rename the Discriminator column? I have abandoned EF Code First as it does not let me specify such schema details. I don't tolerate having no control over all of my table field names!
stackoverflow.com/…/cannot-rename-discriminator-column-in-entity-framework-4-1-code-first-database
This question has some overlap with RIA services but I assume it's more dependent on EF than on RIA.
When I add an item to a collection property of an object, the context won't trigger an update. Is this normal?
More details here: stackoverflow.com/…/ria-ef-4-1-wont-update-object-if-i-add-item-to-collection-property
Hi
Is this version of EF compatible with Visual Web Developer 2010 Express Edition with Mysql Database ?
Thanks.
@Triven – Yes – you'll just need the MySQL EF provider. BTW you should use the latest version of EF rather than EF4.1 – head to http://msdn.com/data/ef for details.