Jaa


EF6.1.2 RTM Available

Today we are pleased to announce the availability of EF6.1.2. This patch release includes a number of high priority bug fixes and some contributions from our community.

 

What’s in EF6.1.2?

EF6.1.2 is mostly about bug fixes, you can see a list of the fixes included in EF6.1.2 on our CodePlex site.

We also accepted a couple of noteworthy changes from members of the community:

  • Query cache parameters can be configured from the app/web.configuration file

     <entityFramework>   
      <queryCache size='1000' cleaningIntervalInSeconds='-1'/>   
    </entityFramework>
    
  • SqlFile and SqlResource methods on DbMigration allow you to run a SQL script stored as a file or embedded resource.

 

Where do I get EF6.1.2?

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

The tooling is available on the Microsoft Download Center. You only need to install the tooling if you want to create models using the EF Designer, or generate a Code First model from an existing database.

 

Thank you to our contributors

We’d like to say thank you to folks from the community who have contributed to the 6.1.2 release so far:

  • BrandonDahler
  • ErikEJ
  • Honza Široký
  • martincostello
  • UnaiZorrilla

 

What’s next?

In addition to working on the next major version of EF (Entity Framework 7), we’re also working on another update to EF6. This update to EF6 is tentatively slated to be another patch release (EF6.1.3) and we are working a series of bug fixes and accepting pull requests.

Comments

  • Anonymous
    December 22, 2014
    Just installed 6.1.2. and ran into problems. I have this TPH design structure that has a Category property (typeof(int)) at the toplevel class. In my derived classes I do something like: public new AddressTypes Category {    get { return (AddressTypes)base.Category; } set { base.Category = (int)value; } } where AddressTypes is an Enum. This worked fine until 6.1.2. Now I receive an error "The item with identity 'Category' already exists in the metadata collection" when I starts the application. Any suggestions      

  • Anonymous
    December 23, 2014
    @Thijs Why do you need Discriminator as property? Discriminator is just a Type of concrete class. Doing query you don't need Discriminator, because you can use Type. For example: Ok: dbContext.OfType<ConcreteA>()... Unnecessary: dbContext.Where(x => x.Category == AddressType.ConcreteA)... Another thing, Discriminator is something immutable per class. Instance of class ConcreteA, should not change its Category to ConcreteB, because it is still ConcreteA = why you need setter for Category?

  • Anonymous
    December 23, 2014
    I made a mistake while typing, "table" property is missing. Should be sth like this: dbContext.SomeTable.OfType<ConcreteA>() If I misunderstand you, and your Category property is not a Discriminator in TPH, there is still sth wrong. Why base class has int, not an Enum? EF supports enum very well. Maybe there is some bug in EF... but I'm pretty sure that your code is wrong :) Am I missing something?

  • Anonymous
    December 23, 2014
    @Mad The Category property is just  typeof(int) in my base class and database. It has nothing to do with the discriminator. In my derived classes I use this Category for various reasons and it is only in the derived classes that they are casted to enums. So a Category in derived class A can have other (enum) values than derived class B. As stated, it worked fine in EF 6.1.1, so my code should be fine. I uninstalled 6.1.2 and reinstalled 6.1.1 and everything works again.     But what is going on? I designed a Code first solution with only two tables with which I can serve many customers and it;s realy fast. My TPH model looks like : Abstract base class A: class B: A (mapped to table 1) class C: A (mapped to table 2)  

60 classes that go down this hierarchy Hope you can help me

  • Anonymous
    December 23, 2014
    @Mad The Category property is only defined in class B and the Enum typecasting is only defined in classes that are first level descendants of class B

  • Anonymous
    December 26, 2014
    @Thijs: Thanks a lot for reporting this. I was able to repro this. Also, not sure if it was you or someone else, but a bug was filed with a different repro involving TPT inheritance: entityframework.codeplex.com/.../2616. We should have enough information to investigate. We will reply with more information when we have it.

  • Anonymous
    December 26, 2014
    @Diego Thanks, keep up the good work

  • Anonymous
    December 30, 2014
    @Thijs could you copy past the base class and the full class which is inheritance it. I'm trying to follow what you have said in your original post and am struggling as I can not see all code in context. As by the sounds of it... I also would of coded it differently.. I would of done something like.... (please post yours so I may learn... as i get the impression that you are wanting something else) public abstract class AbsClass {  public abstract int CategoryId {get; set;} } public class EntityA : AbsClass {    [NotMapped]    public AddressTypes Category   {       get{return (AddressTypes)base.CategoryId }    } }

  • Anonymous
    December 31, 2014
    @Calvin - The issue in question is only hit when you hide the property on the base type with a property with the same name on the derived type. Your example works fine because the NotMapped property on the derived class has a different name and isn't hiding the property from the base class. More info on the issue is here - entityframework.codeplex.com/.../2616

  • Anonymous
    January 07, 2015
    I've found that there appears to be something wrong with the query generator in EF 6.1.2. I'm using MySQL. I'm not sure if I would run into the problem if I was using SQL Server. The following query throws an exception stating that the SQL is invalid. If I comment out the line where the DonorCodes property is being assigned, the query works. Also, if I downgrade to 6.1.1, it works. I have ran into the same problem in another application where I had a query that was doing a lot of .Includes().            var q = oleContext.OrderItems.AsQueryable();            OrderItemsRadGrid.DataSource = (from oi in q                                            where oi.ItemTypeCode == "ITEM"                                            orderby oi.Order.CreationTime descending                                            select new                                            {                                                oi.Id,                                                oi.Order.Number,                                                oi.OrderId,                                                oi.Order.CreationTime,                                                oi.Order.Document.Status,                                                VendorName = oi.Order.Vendor.Name,                                                oi.Order.VendorId,                                                oi.Order.VendorId2,                                                AccountCodes = oi.OrderItemAccounts.Select(oia => oia.AccountCode),                                                DonorCodes = oi.OrderItemDonors.Select(oid => oid.DonorCode),                                                VendorInstructions = oi.OrderItemNotes.Where(oin => oin.NoteTypeId == 6).Select(oin => oin.Note),                                                oi.Order.VendorCustomerId,                                                DeliveryRoom = oi.Order.DeliveryRoom.Name,                                                ExtendedCost = oi.UnitPrice * oi.Quantity,                                                oi.VendorItemId,                                                oi.BibInfo.BibId,                                                oi.BibInfo.Bib.Content,                                            }).ToArray()

  • Anonymous
    January 09, 2015
    @Jon - Could you open an issue for this - entityframework.codeplex.com/.../Create. Can you include the exception/stack trace you are seeing and the full code (including model) to reproduce the issue.

  • Anonymous
    January 12, 2015
    The comment has been removed

  • Anonymous
    January 23, 2015
    Definitely looking forward to faster startup time in 7. Maybe the initialization can be parallelized in 7? I have an app that has 1,400 entities in it. It takes about 35 seconds on my desktop, but, more like 3 minutes on the server which is dated.

  • Anonymous
    January 26, 2015
    @Jon - We haven't done benchmarks and tuning in this area yet... but the simplified metadata system looks to be giving us some good perf improvements.

  • Anonymous
    January 26, 2015
    @Fernando - We aren't working on that change right now - though it would make a good contribution. There will be some significant improvements in this area in EF7.

  • Anonymous
    January 27, 2015
    One thing I was thinking of is if it would be possible for EF to lazily initialize the model as needed. I.e. Say I have 1,400 entities, but, a particular app that makes use of the model only uses one entity. Make it so that EF only loads the metadata for that entity and any entities that it references. I'm thinking the fluent API would make this problematic. If it were purely attribute based, I think it would be easier.

  • Anonymous
    January 29, 2015
    @Jon - We have considered this. It's not clear yet how much it will be needed in EF7. Our metadata model is so much lighter weight that it could be what used to be considered a 'large model' is now fast enough (and uses low enough memory) that lazy initialization becomes irrelevant. As you mentioned, when we are building the model on the fly it can't really be lazily created. Even when using annotations, processing one entity can have an effect on another entity. What we will look at is the ability to compile a model and then lazily load it during runtime.

  • Anonymous
    February 10, 2015
    I've been running into a problem where some of the queries that are being generated either by EF or EntityDataSource are doing something like the following where it's generating a SELECT in a SELECT. I'm using EntityDataSource with Telerik's RadGrid control for ASP.NET AJAX. Not sure if that has anything to do with it. The page size is 100, so, it's generating a LIMIT expression since I'm using MySQL. However, it's adding the LIMIT at the end and these tables have millions or rows in them. So, it's doing a JOIN on millions of rows, then truncating the results after the fact which ends up in poor performance. I have no idea why nested queries are being generated like this. Any chance this might be fixed in EF 7 or a future version of EF 6? Also, I'm wondering why EntityDataSource is being dropped in EF7? I'm going to need it for my app. Maybe I can get the source from EF 6 and try to update it myself. Not sure how complicated that would be or what the best way to dynamically build queries in EF 7 is. Also, I think that model binding in ASP.NET Web Forms needs to be improved. If I remember correctly, you can't sort on Navigation property properties. For example, say an Order has a Customer. You can't sort on Item.Customer.Name. Even though, you can bind that property to the display. SELECT Project1.C1, Project1.BIB_ID_STR, Project1.BIB_ID, Project1.TITLE, Project1.AUTHOR, Project1.PUBLISHER, Project1.ISXN, Project1.BIB_ID1, Project1.FORMER_ID, Project1.FAST_ADD, Project1.STAFF_ONLY, Project1.CREATED_BY, Project1.DATE_CREATED, Project1.UPDATED_BY, Project1.DATE_UPDATED, Project1.STATUS, Project1.STATUS_UPDATED_BY, Project1.STATUS_UPDATED_DATE, Project1.UNIQUE_ID_PREFIX, Project1.CONTENT FROM (SELECT Extent1.BIB_ID_STR, Extent1.BIB_ID, Extent1.TITLE, Extent1.AUTHOR, Extent1.PUBLISHER, Extent1.ISXN, Extent2.BIB_ID AS BIB_ID1, Extent2.FORMER_ID, Extent2.FAST_ADD, Extent2.STAFF_ONLY, Extent2.CREATED_BY, Extent2.DATE_CREATED, Extent2.UPDATED_BY, Extent2.DATE_UPDATED, Extent2.STATUS, Extent2.STATUS_UPDATED_BY, Extent2.STATUS_UPDATED_DATE, Extent2.UNIQUE_ID_PREFIX, Extent2.CONTENT, 1 AS C1 FROM ole_ds_bib_info_t AS Extent1 LEFT OUTER JOIN ole_ds_bib_t AS Extent2 ON Extent1.BIB_ID = Extent2.BIB_ID) AS Project1 ORDER BY Project1.BIB_ID_STR ASC LIMIT 0,100

  • Anonymous
    February 10, 2015
    @Jon - Yes, a lot of those nested queries are much simpler in EF7. We probably won't be improving it on EF6.x though because anytime we touch something in query it has a tendency to have ripple effects that end up breaking something in an obscure place for some providers. Whether or not we have Entity Data Source will be driven by customer demand. We'd encourage folks to use model binding instead, but if there is significant demand for scenarios that are best served by a custom data source then we will consider doing it.

  • Anonymous
    March 10, 2015
    The comment has been removed

  • Anonymous
    March 13, 2015
    @Luís Oliveira - Here is some documentation on using EF with WinForms msdn.microsoft.com/.../jj682076. If you have specific questions beyond what is covered there, it would be best to ask them on StackOverflow.com (be sure to use the entity-framework tag).