Freigeben über


EF4.3.1 and EF5 Beta 1 Available on NuGet

 


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.


 

Today we are pleased to announce the release of two new versions of the EntityFramework NuGet package.

The 4.3.1 version includes some bug fixes for the 4.3 package we released a few weeks ago. We are also making the first beta of EF 5 available as a pre-release package.

 


What’s in 5.0.0-beta1

This is the first preview of EF 5 and includes all the features and bug fixes in EF 4.3.1 in addition to a number of new features that are available in applications targeting .NET Framework 4.5. ( You will need Visual Studio 11 Beta to work with the .NET Framework 4.5)

  • Enum support allows you to have enum properties in your entity classes. This new feature is available for Model, Database and Code First.
  • Table-Valued functions in your database can now be used with Database First.
  • Spatial data types can now be exposed in your model using the DbGeography and DbGeometry types. Spatial data is supported in Model, Database and Code First.
  • The Performance enhancements that we recently blogged about are included in EF 5 Beta 1.
  • Visual Studio 11 includes LocalDb rather than SQLEXPRESS. The EntityFramework NuGet package will now check which database is available when the package is installed and use a configuration file setting to set the default database server that Code First databases will be created on.If SQLEXPRESS is running, it will be used. If SQLEXPRESS is not available then LocalDb will be registered as the default instead.

The following new features are also available in the Entity Model Designer in Visual Studio 11 Beta:

  • Multiple-diagrams per model allows you to have several diagrams that visualize subsections of your overall model.
  • Shapes on the design surface can now have coloring applied.
  • Batch import of stored procedures allows multiple stored procedures to be added to the model during model creation.

 

Known Issues

We will keep this list updated with known issues for this release:

  • There is a known issue using the Code First Migrations commands in Visual Studio 2010. We are working on an updated package that addresses this issue. You will receive the following error when using migrations commands from EF 5 Beta 1 in Visual Studio 2010:
    Could not load file or assembly 'Microsoft.VisualStudio.Shell.10.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
  • There is a known issue in MVC4 applications in Visual Studio 11 that is described in more detail here.

.

Getting Started

You can get EF 5 Beta 1 by installing the latest pre-release version of the EntityFramework NuGet package.

InstallPackage

These existing walkthroughs provide a good introduction to using the Code First, Model First & Database First workflows available in Entity Framework:

We have created walkthroughs for the new features in EF 5:

 

Compatibility

This version of the NuGet package is fully compatible with Visual Studio 11 Beta and can be used for applications targeting .NET 4.0 and 4.5.

The new features listed above will only be available when writing an application that targets .NET 4.5.

EF 5 will work with Visual Studio 2010 but there is currently a known issue that prevents the Code First Migrations commands from being used in Visual Studio 2010. See the Known Issues section (above) for more details.

 


What’s in 4.3.1?

A few weeks back we released EF 4.3, which included the new Code First Migrations feature and a few bug fixes. Today we are releasing the 4.3.1 patch release that includes some bug fixes to the 4.3 release.

This is a fully supported go-live release.

The changes in 4.3.1 compared to 4.3 include:

  • Templates for using DbContext with Model First and Database First have been renamed from ADO.NET DbContext Generator to EF 4.x DbContext Generator. We made this rename to easily distinguish between the EF 5.x DbContext Generator that is to be used for EF 5 applications.
  • Added the ability to enable Code First Migrations against an existing database. Julie Lerman blogged about using an empty initial migration to capture the initial state of the model when it is in sync with an existing database. Once this migration is generated Code First Migrations will correctly detect and scaffold changes to your model. You can now use the –IgnoreChanges to tell Code First Migrations not to scaffold any code for this initial migration (i.e. ‘Add-Migration InitialMigration –IgnoreChanges).
  • Visual Studio 11 includes LocalDb rather than SQLEXPRESS. The EntityFramework NuGet package will now check which database is available when the package is installed and use a configuration file setting to set the default database server that Code First databases will be created on. If SQLEXPRESS is running, it will be used. If SQLEXPRESS is not available then LocalDb will be registered as the default.
  • Fixed issue where TPC mapping in Code First was generating “Unknown Columnname” exceptions when accessing the database.
  • Fixed issue where hard coded column data types were not honored in generated databases. If you used the Column data annotation or HasColumnType Fluent API method to hard code a column data type (i.e. xml, money, etc.), this data type was not used when creating the database.
  • Fixed issue preventing decimal columns from being configured with the ‘Identity’ store generated pattern.
  • We now provide a better exception message when context/database initialization fails due to connectivity issues with the database.
  • Enabled support for configsource in configuration files when using Code First Migrations.
  • Fixed issues using Moq with DbContext – as reported in this Stack Overflow question.

 

Getting Started

You can get EF 4.3.1 by installing the latest version of the EntityFramework NuGet package.

InstallEntityFramework

Check out the EF 4.3 release post for details and walkthroughs for EF 4.3.

 

Compatibility

This version of the NuGet package is fully compatible with Visual Studio 2010 and Visual Studio 11 Beta. It is designed to be used when writing .NET 4.0 applications.

If writing a .NET 4.5 application we recommend using the 5.0.0-beta1 version of the package instead. You can use the package in .NET 4.5 applications but you should be aware of the following known issue:

Entity Framework 4.1 thru 4.3 included additional data annotations in the System.ComponentModel.DataAnnotations namespace in the EntityFramework assembly. In .NET 4.5 these annotations were moved to be part of the .NET Framework in the System.ComponentModel.DataAnnotations.Schema namespace of the System.ComponentModel.DataAnnotations.dll assembly. If you are using EF 4.x and targeting .NET 4.5 this results in two data annotations with the same name in different assemblies. Because the annotations in the .NET Framework are in a different namespace we were not
able to use type forwarding to avoid this conflict.

If you are not using the affected data annotations there is no impact on your code. If you are using the data annotations in a C# project you can use the extern modifier to ensure your code uses the annotations from EntityFramework.dll (https://msdn.microsoft.com/en-us/library/e59b22c5(v=VS.80).aspx). If you use the new annotations from the System.ComponentModel.DataAnnotations.dll assembly in .NET 4.5

 


Support

We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow.

We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.

 

Entity Framework Team

EF5.0.0-beta1_License.rtf

Comments

  • Anonymous
    February 29, 2012
    4.3.1 doesn´t have Beta? You said that every release will have a beta, since the release that prevent profilers to work. If I copy all EF5 dependencies from .NET 4.5, I can use it at .NET 4.0? Like I did with 3.5SP1 and 3.5, copying System.Data.Entity.dll.

  • Anonymous
    February 29, 2012
    "Table-Valued functions in your database can now be used with Database First." What about Model First and Code First?

  • Anonymous
    February 29, 2012
    Does anyone know if the support for unique constraints described here is in the Beta of 5? blogs.msdn.com/.../unique-constraints-in-the-entity-framework.aspx I'm hoping that associations based on unique constraints makes the cut and is included in EF 5.

  • Anonymous
    February 29, 2012
    One other thing that I would like to see is the ability to define value types as nullables in the conceptual model, that are not null in the store model. For example, say I have a datetime in the database. I want it to be NOT NULL. But, I want it to be DateTime? at the class-level. That way if I bind to the property in a UI, the default value is blank/null rather than 1/1/1900 or whatever the default value is for a non-nullable DateTime. The same thing would be true for any other value type. Not sure if this works with code first or not. I'm using database first with an EDMX. The designer won't let you set the nullability to nullable in the conceptual model and non-nullable in the store model.

  • Anonymous
    February 29, 2012
    The comment has been removed

  • Anonymous
    February 29, 2012
    @John Miller2: Regarding Unique Constraints, unfortunately the answer is no. The feature didn't make the cut for EF 5. We are looking at including it in a future release depending on its relative priority. I encourage you to vote for it if it is important to you: data.uservoice.com/.../1050579-unique-constraint-i-e-candidate-key-support.

  • Anonymous
    February 29, 2012
    @Felipe Fujiy: Re not having a beta for 4.3.1, we are still trying to follow the rule of always having a beta, but there are a few reasons we decided to make an exception in this case:

  • The scope of the changes is very small.
  • It is sort of a date driven release for EF: we needed to have something out at the same time as EF 5.0 beta 1, and we wanted to publish EF 5.0 beta 1 the same day VS 11 beta and .NET 4.5 Beta went out.
  • It would be a little confusing to have two betas going on at the same time.
  • 4.3.1 is a patch release following the go live of a large new feature (Migrations). You can expect us to follow this pattern in the future when issues are found (although in some cases we might choose to still have a beta if the scope of the changes is very big). Regarding using .NET 4.5 assemblies with .NET 4.0, although you might be able to get some things to work, what you are describing is not a tested or supported configuration, so I wouldn’t recommend you to do it.
  • Anonymous
    February 29, 2012
    As much as I hate to say it, I don't think I'm going to be making use of the new enums feature. I need it to store a string value rather than an int in the database. That way if I'm generating reports from Reporting Services, what comes out on the reports are meaningful values. Also, it seems like the new designer should default to using DbContext if that's the new recommended API. It would also be nice if the number of properties that you can specify for an object in the designer was increased. I.e. it would be nice to specify values for all the annotations that appear in the System.ComponentModel.DataAnnotations namespace for things like Required, RegularExpression, DisplayName, etc. It would also be nice if fields like DisplayName were generated automatically using a convention such as inserting spaces between words. And also, as I mentioned before, it should be possible to have a nullable value type in the conceptual model, but, have it be non-null on the store side.

  • Anonymous
    February 29, 2012
    The EF Core is embedded with .NET 4.5, so EF 5 will only be available against .NET 4.5? There's any chance to EF 5 and EF Core become only one library? I mean something independent. It's too hard to know the fact that we'll have to wait another version of .NET to receive awesome features like that aforementioned. By the way, I'm very(I said VERY) excited with those news features! Thank you guys.

  • Anonymous
    February 29, 2012
    @Jon Miller: You can store the int of enum in your column and handle the description with reflection, using the DescriptionAttribute above each enum property so use reflection to catch the description from enum's properties. I missed something like you said about designer, the possibility of add/edit DataAnnotations of properties. This is something that will increase a lot the creation of entities.

  • Anonymous
    February 29, 2012
    @Kim Tranjan: We are indeed looking at incorporating the EF functionality that today is implemented in the .NET Framework into our out-of-band releases. This is not happening in EF 5 though.

  • Anonymous
    February 29, 2012
    How does one update a project to V5 from the CTP? I'm trying to figure out what files need to be updated in references etc. after doing the package manager command.

  • Anonymous
    February 29, 2012
    @Jon Miller2: Re making the DbContext API the default for the Entity Designer, we are looking at that for VS 11 RTM but can't promise the change will make it on time.

  • Anonymous
    February 29, 2012
    A nice set of features. Don't miss out on the little ones tough: Migration from L2S is still a nightmare because LINQ support is not as sophisticated yet (DateTime.Date for example is a major show-stopper).

  • Anonymous
    February 29, 2012
    Thanks for release! Btw. do you have any roadmap of features you would like to implement in the near future?

  • Anonymous
    February 29, 2012
    The comment has been removed

  • Anonymous
    February 29, 2012
    @Jon Miller: Both enums mapped to string values and nullable properties mapped to non nullable columns are features belonging to area of simple type mapping or mapped conversions. Unfortunately EF doesn't have this feature yet.

  • Anonymous
    February 29, 2012
    Updated to EF5 from June 2011 CTP and started to get "Sequence contains more than one element" exceptions thrown at navigation property configuration... Something with mappings maybe

  • Anonymous
    February 29, 2012
    Updated to EF5 from June 2011 CTP and now any attempt to query database results in "Sequence contains more than one element" exception thrown at navigation property configuration... Something with mappings maybe

  • Anonymous
    February 29, 2012
    @Diego B Vega: First of all, you guys do great work! You mention though the TVF walkthrough contains some links for workarounds for Code First in the first few paragraphs. I only see stored procedures mentioned in those links, not TVFs. The main thing about using TVFs is that they are composable. I don't think those workarounds are composable, right? Therefore they are not workarounds for using TVFs with Code First. Can we expect a proper TVF solution for Code First for EF 5.0 RTM instead of workarounds? Please also have a look at code.msdn.microsoft.com/Recursive-or-hierarchical-bf43a96e for one of my workarounds where I would like to slot in TVFs. Many thanks, Remco

  • Anonymous
    February 29, 2012
    The comment has been removed

  • Anonymous
    February 29, 2012
    @Jon Miller2, @Ladislav Mrnka: Agreed that mapping string columns to enums is a relatively common thing to want to do, and Ladislav is right that it is not supported in EF 5.0 and that the way we would like to support this in the future is to support more general property transformations in the mapping. I am a little surprised to hear you can't  map a nullable property to a non-nullable column though. In general we don't block on nullability mismatches. Could you please send an example of what you are seeing? You can use the "Email blog author" link in this page to contact us. We will pick it up from there.

  • Anonymous
    February 29, 2012
    What kind of TPT enhancements can be expected when running 4.3.1 on the .net 4.5 beta?

  • Anonymous
    February 29, 2012
    @Diego B Vega. Thanks for your response. I'm trying to think here, EF 5.0 cannot RTM before .Net 4.5 RTMs, which cannot RTM before Windows 8 RTM's, which is expected by ... Q4 2012? And then sometime after that we'll see TVF support in Code First...which takes us into .. 2013? I'll have to exercise patience ;-) The reason why I want to use LINQ instead of SQL is to be database agnostic, so that I can use either a MS SQL Server provider or an Oracle provider, but only write my LINQ once. See the discussion here: social.msdn.microsoft.com/.../c81dfd60-ede5-4873-9f4d-04e240c293c2. Anyway, keep up the good work EF Team!

  • Anonymous
    February 29, 2012
    @Remco Blok: I don’t actually have the dates for RTM, but I understand the pain of having to wait for a feature you need. Although I cannot promise much, we are working on taking the EF stack out-of-band completely so that we can release more often. Thanks for the link.

  • Anonymous
    February 29, 2012
    I really don't want that, but it seems like the old CTP 5 bug is back. If an entity has more than one many-to-many relationship, EF breaks. Just reproduced it on the simplest scenario with 3 entities.

  • Anonymous
    February 29, 2012
    Does DBContext and Generate code from model work with this release? I'm pulling my hair getting it running in my current set up(Windows 8, VS11 Dev Preview)

  • Anonymous
    February 29, 2012
    Versioning... it's not rocket science you know. "Microsoft.VisualStudio.Shell.10.0, Version=11.0.0.0"

  • Anonymous
    February 29, 2012
    Can anyone else confirm (or even better disprove) that having multiple many-to-many relationships within an entity in EF5 results in crashes?

  • Anonymous
    February 29, 2012
    In the Compatibility section of EF5, you say: 'EF 5 will work with Visual Studio 2010'. But if all the new features are available if you target .NET 4.5 and use Visual Studio 11, what's the point in using Visual Studio 2010? Or the performance enhancements are available for VS2010 and .NET 4.0 with EF5?

  • Anonymous
    March 01, 2012
    @Pablo Barragan, I did a test, when I install EF5 on .NET 4 VS2010, it references a EntityFramework.dll v4.3.1

  • Anonymous
    March 01, 2012
    @Viktar I just wrote a little app with two many-to-many relationships and it worked as expected. Could you use the "Email blog author" link and send us a repro showing how it fails for you?

  • Anonymous
    March 01, 2012
    @Pablo Feel free to continue to use EF 4.3.1 when targeting .NET 4. There is no real advantage to using EF5 on .NET 4, but we didn't want it to fail if you do want to use EF5 on .NET 4.

  • Anonymous
    March 01, 2012
    The comment has been removed

  • Anonymous
    March 01, 2012
    @Diego B Vega: So Code-First is still not a first-class citizen of the EF world? I'm quite happy to create the TVFs in the database, but if I can't use them from EF/CF, then it's not really a viable solution for any real-world project.

  • Anonymous
    March 01, 2012
    @Ladislav Mrnka – We don’t have a roadmap for features just yet. We’re in planning stage at the moment and mostly focused on how we move more of the Entity Framework code out of the .NET Framework and into the NuGet package. @lynn eriksen – The improvements are in the queries that we generate, mainly around replacing UNION with LEFT OUTER JOIN. @OakNinja – Yes, this post walks through how to generate DbContext code from an edmx based model. blogs.msdn.com/.../ef-4-2-model-amp-database-first-walkthrough.aspx @Mike – Yeah, the issues we are hitting are technical ones in NuGet. We are one of the first teams to be releasing on NuGet that have different assemblies for .NET 4.0 and .NET 4.5, this makes the Package Manager Console based tooling hard because the ‘tools’ folder in NuGet isn’t setup for multi-targeting yet. We’re working on a temporary fix and also working with the NuGet folks to get native support for this scenario.

  • Anonymous
    March 01, 2012
    The comment has been removed

  • Anonymous
    March 01, 2012
    @Pablo Barragan & @Felipe Fujiy – Just to add to what Arthur said – The EF5 bits on .NET 4.0 are the same as what we shipped in EF4.3.1. This may change as we move through the releases and towards an RTM of EF 5. We aren’t planning to add any new features that will be available on .NET 4.0 but we may make bug fixes etc.

  • Anonymous
    March 01, 2012
    Just noticed something... When creating a new MVC 4 application in VS 11 beta (which includes EF 4.3.1, I believe) the default connection string goes to localdb. However, as soon as I install the EF 5 beta, some config is added to my Web.config file that sets it back to Sql Express. I assume the package does this to support .NET 4.0 and VS2010.  Is there a any way you can detect the framework version being used and not add this stuff for .NET 4.5 so it will continue to use localdb? In any case, thanks so much for your great work on this. I'm really appreciative of the massively increased release velocity that these out-of-band releases allow.

  • Anonymous
    March 01, 2012
    The comment has been removed

  • Anonymous
    March 01, 2012
    "The context cannot be used while the model is being created" EF5.. how to fix?

  • Anonymous
    March 01, 2012
    @Leandro This happens when the context is used inside a call to OnModelCreating. It's not possible to use the context for querying, updates, etc inside OnModelCreating because EF needs a model to be able to do these things. OnModelCreating is part of the process used to create this model and hence you cannot do these things until after OnModelCreating has completed and the model has been created.

  • Anonymous
    March 01, 2012
    @Rowan Miller  It would be great if you could include the perfromance improvements in a future release for .NET 4.0. I was really excited about these improvements

  • Anonymous
    March 01, 2012
    I'm not running anything inside the "OnModelBuilder"! Also already tried without the "OnModelCreating" and failed.

  • Anonymous
    March 01, 2012
    OnModelCreating*

  • Anonymous
    March 01, 2012
    It is extremely depressing the there still is no support for TVF in Code First.

  • Anonymous
    March 02, 2012
    Hey Rowan, I'm getting ready to publish modified versions of the EF4x and EF5x DbContext T4 templates that include support for DataAnnotations and IntelliSense code comments, derived from the EDMX file. I love the new type support in EF5, but I was wondering if it would be possible to add support for the <Documentation> tag in the designer, for both the Enum itself, and it's members? I've confirmed that they work in the XML, but it would be nice to be able to edit them in the UI like the other EF objects as well. Thanks! Robert McLaws twitter.com/robertmclaws

  • Anonymous
    March 02, 2012
    @Leandro Could you use the "email blog author" link and send us a repro?

  • Anonymous
    March 02, 2012
    @Robert I will add your request about being able to edit documentation for enum types and members to our backlog

  • Anonymous
    March 02, 2012
    "We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow." One of the best statements I've ever seen from Microsoft!

  • Anonymous
    March 02, 2012
    @Leandro: Check this: stackoverflow.com/.../how-can-i-prevent-ef-the-context-cannot-be-used-while-the-model-is-being-create I'm not sure if this problem still exists in newer versions but previously this could happen if two context were used in the same time (by multiple threads) without previous initialization of the DbModel.

  • Anonymous
    March 02, 2012
    The problem was that he was showing the error message: The context can not be used while the model is created being wellness When in fact the error was the same as was reported in: Known Issues Can disregard the email I sent with the error. thanks for the support

  • Anonymous
    March 02, 2012
    @Jon Miller: I started a suggestion on UserVoice - you can vote for it if you think this is important: data.uservoice.com/.../2639292-support-for-simple-type-mapping-or-mapped-type-con

  • Anonymous
    March 02, 2012
    I keep getting this error Could not load type 'System.ComponentModel.DataAnnotations.DatabaseGeneratedAttribute' from assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. I'm using win8 consumer preview, vs11 beta and ef 5.0.

  • Anonymous
    March 03, 2012
    @Ivan: EF 5.0 is a new major version and contains breaking changes, so you will need to make changes to your 4.x program and recompile. One of those changes is that some of the data annotation attributes that were included in EntityFramemowrk.dll 4.x moved to System.ComponentModel.DataAnnotations.dll in .NET 4.5. This attribute in particular moved to the System.ComponentModel.DataAnnotations.Schema namespace, so you'll need at least to add a using statement for that.

  • Anonymous
    March 03, 2012
    @Diego: I didn't even use this attribute (or any other). I created a new asp.net mvc 4 application, updated ef to 5.0beta, and scaffolded controller, views and dbcontext. When I run it, I get that exception at runtime. I added the using statement to my model, as you suggested, but the error persists. Thoughts?

  • Anonymous
    March 03, 2012
    @Ivan: In that case I am not sure what is going on. Would it be possible for you to send us a repro in a zip file? You can use the "email blog author" link in this page and we will reply with an email address. Thanks a lot in advance.

  • Anonymous
    March 03, 2012
    F# project with "Install-Package EntityFramework -IncludePrerelease" gave some errors...

  • Anonymous
    March 03, 2012
    In my solution, use Solution Folder.  when run Add-Migration  throw exception.  I finally found if move the project out of the folder. it will work fine.  

  • Anonymous
    March 04, 2012
    It seems [DisplayFormat(ConvertEmptyStringToNull = false)] doesn't working in the new release 4.3.1! I have a class definition: public class Person {  public int Id { get; set; }  [Required]  public string Name { get; set; }  [Required]  [DisplayFormat(ConvertEmptyStringToNull = false)]  public string Description { get; set; } } When try add new Person with empty Description, validation exception occurred: var person = new Person {Name="Tester", Description="" }; But in EF4.1, there is no problem with ConvertEmptyStringToNull setting . Please help! Thanks!

  • Anonymous
    March 04, 2012
    Hello Team, I wonder how I can check which "version" of the current migration. And how to remove the history of the project so that you can make a new "Add-Migration" from the beginning.

  • Anonymous
    March 04, 2012
    @Leandro C. Guimarães 1.I view the version through the history table.

  1. roll back Update-Migration -targetmigration.  then delete the migration and re set-up again. this is my way.
  • Anonymous
    March 04, 2012
    As reported in an earlier comment, we are also getting an exception with EF5 beta 1 the “Sequence contains more than one element” exception. @Diego, I see from your post here twitter.com that you are aware of this problem.  Could you give any more info on the cause of it, whether there are any workarounds, and when you plan to release a fix? There are more details on the exact exception I am getting here: stackoverflow.com/.../ef-5-beta-1-code-first-sequence-contains-more-than-one-element We have a large solution which uses EF Code First, we can’t wait to try out the performance improvements so I’m very keen to get past this exception.

  • Anonymous
    March 05, 2012
    Has any progress be made on the "circular reference error when returning a serialized object" bug?Basically, the issue is that a EF class (such as from Code First) with a virtual ICollection property will throw a "circular reference" when serialized. A [ScriptIgnore] attribute should stop the problem from happening but seems to be ignored. With the current effort made to simplify service access with the Web API etc. this would seem to require attention. Any possibility this is going to be addressed for 5.0? Here are links describing the problem with some way to get around it: stackoverflow.com/.../how-did-i-solve-the-json-serializing-circular-reference-error stackoverflow.com/.../circular-reference-exception-with-json-serialisation-with-mvc3-and-ef4-ctp5w BTW. Good news about the DataAnnotations moving out of the EntityFramework.dll !

  • Anonymous
    March 05, 2012
    @Viktar, @Paul2zl, This is a known bug in EF5 Beta 1. We are going to fix this in Beta 2, which will be dropping within the next couple of weeks. The bug only affects Independent Association (associations where the FK does not exist in your CLR classes) so you can workaround by switching to FK associations. Apologies for the inconvenience. Cheers, Andrew.

  • Anonymous
    March 05, 2012
    @Khaled – TVF (and SPROC) support for Code First are absolutely on our backlog, but they just didn’t make it into this release. We use http://ef.mswish.net to help with prioritization so please be sure to vote for the features you want to see. @Tuomas Hietanen – Can you start up a Stack Overflow thread with the exact errors you are seeing. @Henry Zhou – Entity Framework doesn’t process ConvertEmptyStringToNull, if you have a UI layer that takes care of replacing null with an empty string that will keep EF validation happy, but EF won’t do this for you. You could override SaveChanges on your context and add logic to take care of this.

  • Anonymous
    March 05, 2012
    @Willc - The best option at the moment is still to disable proxy creation. We are going to take a look at what we can do in EF to solve this problem in the next version, but not in EF 5.

  • Anonymous
    March 05, 2012
    Um... screenshots of... console commands? So much for copying and pasting...

  • Anonymous
    March 05, 2012
    Um...and this bug? fixed? www.morgia.info/.../Entity-Framework-EntityFunctionsCreateDateTime-and-Leap-Year.aspx

  • Anonymous
    March 05, 2012
    Will EF 5 (EF designer in VS11) support entity model devided by several files to improve parallel work of many developers and to decrease number of conflicts (during merge) caused by parallel model changing of edmx file?

  • Anonymous
    March 06, 2012
    @ryuuseki – Fair point, we’ll use text in the future :) @Rwing – Our team is looking at that bug at the moment, I’ll get back to you with the outcome. @Alexey – EF5 supports multiple diagrams but those diagrams still target a single EDMX file. Multiple model files isn’t something we are planning to support in EF5. Please vote for the feature on our wishlist http://ef.mswish.net, we use this site when prioritizing features for the next release.

  • Anonymous
    March 06, 2012
    @Rwing – Diego, from our team, has followed up on the blog post.

  • Anonymous
    March 06, 2012
    It looks like the issue when using an abstract base class in a TPT inheritance model has not been resolved. Is this going to be fixed in the release? See blogs.msdn.com/.../announcing-the-microsoft-entity-framework-june-2011-ctp.aspx and thedatafarm.com/.../entity-framework-june-2011-ctp-tpt-inheritance-query-improvements

  • Anonymous
    March 06, 2012
    A few questions about EF 5 -- since I am die-ing for access the the Geography data types in EF.

  1. Will EF5 work in VS 11 only?
  2. If so, I guess we are some time away from ready-for-prime-time release.  If not, when might we go to RTM? --mike
  • Anonymous
    March 07, 2012
    Working on VS 11 Beta I keep getting the error described in the linked stackoverflow post. Creating a new project installing EF from the package manager console and all works fine. A soon as I upgrade to EF 5 beta project throws following error when trying to savechanges. Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean) link: stackoverflow.com/.../can-anyone-spot-why-i-keep-getting-this-error-testing-the-ef-5-beta

  • Anonymous
    March 07, 2012
    @Drauka: I responded to your question on Stack Overflow. It looks like you are using the wrong EntityFramework.dll for your target framework.

  • Anonymous
    March 07, 2012
    @Coop – EF5 will work in VS 2010 and VS 11 (there is a bug in Beta 1 that prevents the Code First Migrations commands from being used in VS 2010). To use the spatial data types you need to be targeting .NET 4.5 though, so you’ll need VS11 for that. We don’t have a date for RTM yet but we are working on a ‘go-live’ release before the RTM of VS11 is available.

  • Anonymous
    March 07, 2012
    @Arthur Unfortunately your suggestions did not solve the problem.

  • Anonymous
    March 07, 2012
    It turned out that the problem @Drauka was having resulted from the EF June CTP failing to uninstall correctly. The Stack Overflow thread linked above contains steps to resolve this.

  • Anonymous
    March 08, 2012
    Can we rename the Discriminator column across TPC and TPH yet? :( stackoverflow.com/.../cannot-rename-discriminator-column-in-entity-framework-4-1-code-first-database

  • Anonymous
    March 08, 2012
    NuGet is down, how do I get EF without NuGet?

  • Anonymous
    March 09, 2012
    Can someone share a pointer on how to run EF against a DB hosted at third party (in my case WinHost)? I am getting an error: Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.

  • Anonymous
    March 11, 2012
    Trouble with validation of empty string. I have a required field for which empty string is allowed, but null is forbidden. I am getting a validation error on SaveChanges(), "namespace field is required". How do I make EDM treat empty string as a valid value? thanks. (There are a lot of posts that bing returns that are not useful.)

  • Anonymous
    March 12, 2012
    Since EF5 is .NET 4.5 only, you will be leaving many people behind,  unless .NET 4.5 RTM will support Windows XP.   There are many WPF applications out there still running on Windows XP.

  • Anonymous
    March 12, 2012
    The comment has been removed

  • Anonymous
    March 12, 2012
    @Pete Mack - That's the default behavior of Data Annotations and not specific to EF, you can change it using the AllowEmptyStrings parameter - [Required(AllowEmptyStrings = true)]

  • Anonymous
    March 15, 2012
    I added a new feature suggestion specifically for Code First support for TVF's here: data.uservoice.com/.../2686351-code-first-support-for-table-valued-functions. The previous feature suggestion for TVF's had 226 votes when it was marked as completed by the EF team saying it will be included in .NET 4.5, but that excluded Code First support. Hopefully we can get those 226 votes again or more on the new feature suggestion I created specifically for Code First support.

  • Anonymous
    March 19, 2012
    Any news on when beta 2 will drop?  I have run into the 'Sequence contains more than one element' bug (stackoverflow.com/.../whats-wrong-with-my-many-to-many-abstract-implementation-sequence-contains-mor) and I am anxious to move forward.

  • Anonymous
    March 20, 2012
    @Remco Blok – We’ll probably add TVF support when we add SPROC support, which is very near the top of our backlog now. @C4702 – We’ve just wrapped up the code for Beta 2, looks like we’ll have it out in the next week (provided we don’t find any major issues with it).

  • Anonymous
    March 21, 2012
    Please publish a step-by-step recipe how to enhance an existing app with an object graph in memory by applying EF 5 code first. Most people I talk  to want to apply Code First without reading Julie Lerman's books... For example this is a European school: Public MustInherit Class Person    Public Property Id As Integer    Public Property Name As String    Public Property FirstName As String    Private Shared mCount As Integer = 0 'count created objects into negative numbers to dedect PKs defined by the DB    Public ReadOnly Property Count As Integer        Get            Return mCount        End Get    End Property    Public Sub New(name As String, firstName As String)        Me.Id = mCount       'use count as Id        mCount -= 1          'we use negative integers to find out whether and when the DB generates the primary key        Me.Name = name        Me.FirstName = firstName    End Sub End Class Public Class Student    Inherits Person    Public Sub New(name As String, firstName As String)        MyBase.New(name, firstName)    End Sub End Class Public Class Teacher    Inherits Person    Public Sub New(name As String, firstName As String)        MyBase.New(name, firstName)    End Sub End Class and School class contains List(Of Teacher) and List(Of Students). What IDs must be changed? How do the FluentAPI calls look like for TPH/TPT/TPC ? ...

  • Anonymous
    March 26, 2012
    How do I load the EF 4.3.1 Debug Symbols / Source for debugging?

  • Anonymous
    March 26, 2012
    I am trying to step into an exception and I am having trouble loading the symbols to I can view some of the variable values to see where in my model the exception is occurring (appears to be building the dynamic proxy). How do I load the EF 4.3.1 Debug Symbols / Source for debugging? It's in a winform test harness. System.Data.Entity.Edm.EdmProperty: Name: Name 'EquipmentPckgDesc' cannot be used in type 'WinForm.EquipmentPckgDesc'. Member names cannot be the same as their enclosing type.

  • Anonymous
    March 27, 2012
    @Johan Botha – The source code for Entity Framework currently isn’t published, which is required to be able to step in and debug. The error you pasted doesn’t seem to be related to EF though, sounds like there is a property with the same name as it’s containing class in your code.

  • Anonymous
    March 27, 2012
    My team and I have really struggled with using the Entity Framework with SQL Azure.  I thought these things "would just work" together!  Turns out, there are tons of transient faults that happen with SQL Azure and EF has no way to handle them.  That is, unless you want to write some really ugly, cumbersome wrapper code which doesn't fully get the job done. My feature request is now the #1 "Azure" tagged EF feature request.  data.uservoice.com/.../2426525-automatically-perform-retry-logic-for-sql-azure Is it possible we'll see this implemented anytime soon? Thank you very much.

  • Anonymous
    March 28, 2012
    Urgent! My code was working fine using EF 4.1. After upgrading to 4.3.1, it does not work anymore. It always throws exception:     Method System.Data.Entity.Database.SetInitializer: type argument 'WcScadaWebApp.DAL.TurbineContext' violates the constraint of type parameter 'TContext'.     during calling below method.        protected void Application_Start()        {            AreaRegistration.RegisterAllAreas();            RegisterGlobalFilters(GlobalFilters.Filters);            RegisterRoutes(RouteTable.Routes);            Database.SetInitializer<TurbineContext>(new TurbineInitializer());        } Could anyone please help me to figure out why?

  • Anonymous
    April 02, 2012
    @Matt - This feature isn't going to be in EF 5 but we are planning to do some SQL Azure related work in EF 6. @Ren Jun - Do you have TurbineContext or TurbineInitializer defined in a separate project. If so it sounds like they may be referencing an older version of EF and you may need to upgrade the NuGet package in those project too. If that's not the problem then start up a thread on Stack Overflow and we'll take a look at it.

  • Anonymous
    April 15, 2012
    @Rowan Miller - (From Ren Jun) Thank you very much. That was the case as you said. It was fixed after updating reference to new EF in another project.

  • Anonymous
    May 04, 2012
    Hi there, I have EF 4.3.1 installed using NuGet, but I can't see "EF 4.x DbContext Generator" in the "Add New Item" choices. Can anyone advise please? Thanks

  • Anonymous
    May 06, 2012
    @Kevin - You'll need to look under the 'Online' tab to see the templates.

  • Anonymous
    May 12, 2012
    It appears that there may be a bug in EF 4.3.1 relating to how the indexes are created. Could you guys take a look at my question stackoverflow.com/.../unhandled-exception-after-upgrading-to-entity-framework-4-3-1 and possibly give us some insight into the changes that were made to the index generation procedure from 4.2 to 4.3? Thanks!

  • Anonymous
    May 14, 2012
    @Jeff, Thank you for reporting this. We will include the fix for this in a future release of EF. As a workaround, you can use Migrations to create your database and remove the redundant call to Index() on the PrivateMakeUpLessons table create code. I'll post more details on your StackOverflow question.

  • Anonymous
    May 14, 2012
    @Brice, Thanks for the quick follow-up. This blog is the reason I chose EF over all the other ORMs out there.

  • Anonymous
    May 16, 2012
    The comment has been removed

  • Anonymous
    May 17, 2012
    @Anson, The Entity Framework is not supprted on the Silverlight runtime. However, our sister technology WCF Data Services is. msdn.microsoft.com/.../bb931106

  • Anonymous
    May 18, 2012
    @Jeff, just and update: the fix for the issue on duplicate indexes will be included in EF5 RTM.