<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Entity Framework</title><link>http://entityframework.codeplex.com/project/feeds/rss</link><description>Entity Framework is an object-relational mapper that enables .NET developers to work with relational data using domain-specific objects. It eliminates the need for most of the data-access code that developers usually need to write. Entity Framework is Microsoft&amp;#8217;s recommended data access technology for new applications.</description><item><title>Created Unassigned: DetectChanges() throws "An item with the same key has already been added." exception after setting a complex type property [1278]</title><link>http://entityframework.codeplex.com/workitem/1278</link><description>Hi,&lt;br /&gt;&lt;br /&gt;In Beta 1 the DbContext.ChangeTracker.DetectChanges&amp;#40;&amp;#41; throws &amp;#34;An item with the same key has already been added.&amp;#34; exception after setting a complex type property.&lt;br /&gt;&lt;br /&gt;See the following code which reproduces the issue. The context.ChangeTracker.DetectChanges&amp;#40;&amp;#41; line is the one to look for.&lt;br /&gt;&lt;br /&gt;It would be great if it is looked at as soon as possible as it is a blocking issue for me.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;&lt;br /&gt;Iouri&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System&amp;#59;&lt;br /&gt;using System.Linq&amp;#59;&lt;br /&gt;&lt;br /&gt;namespace EF6b1.ComplexProperty.Bug&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#9;public class ComplexType&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;public virtual int&amp;#63; Value1 &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;public virtual int&amp;#63; Value2 &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;public class Entity&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;public virtual Guid Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;public virtual ComplexType ComplexProperty &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;public class DbContext &amp;#58; System.Data.Entity.DbContext&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;public DbContext&amp;#40;string connectionString&amp;#41; &amp;#58; base&amp;#40;connectionString&amp;#41; &amp;#123; &amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;public virtual System.Data.Entity.IDbSet&amp;#60;Entity&amp;#62; Entities &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;#9;class Program&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;static DbContext CreateDbContext&amp;#40;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;return new DbContext&amp;#40;&amp;#64;&amp;#34;Data Source&amp;#61;&amp;#40;local&amp;#41;&amp;#92;sql2012&amp;#59;Initial Catalog&amp;#61;EF6b1.ChangeTrackingBug&amp;#59;Integrated Security&amp;#61;True&amp;#59;MultipleActiveResultSets&amp;#61;True&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;static void Main&amp;#40;string&amp;#91;&amp;#93; args&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;try&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;using &amp;#40;var context &amp;#61; CreateDbContext&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;var entity &amp;#61; context.Entities.Create&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;context.Entities.Add&amp;#40;entity&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;entity.Id &amp;#61; Guid.NewGuid&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#47;&amp;#47;&amp;#40;IS&amp;#41; at the moment EF requires the complex type proeprties to be explicitly set to non-null values - I dont think it&amp;#39;s right&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;entity.ComplexProperty &amp;#61; new ComplexType&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;context.SaveChanges&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;using &amp;#40;var context &amp;#61; CreateDbContext&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;var entity &amp;#61; context.Entities.Take&amp;#40;1&amp;#41;.First&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;entity.ComplexProperty &amp;#61; new ComplexType&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#47;&amp;#47;&amp;#40;IS&amp;#41; this will fail with &amp;#34;An item with the same key has already been added.&amp;#34; exception originating in EntityEntry.ExpandComplexTypeAndAddvalues&amp;#40;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#9;context.ChangeTracker.DetectChanges&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;Console.WriteLine&amp;#40;&amp;#34;Finished with no errors.&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;catch &amp;#40;Exception e&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#9;Console.WriteLine&amp;#40;e.ToString&amp;#40;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;Console.WriteLine&amp;#40;&amp;#34;Press any key to exit...&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;Console.ReadKey&amp;#40;true&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;</description><author>iouri</author><pubDate>Wed, 19 Jun 2013 00:26:02 GMT</pubDate><guid isPermaLink="false">Created Unassigned: DetectChanges() throws "An item with the same key has already been added." exception after setting a complex type property [1278] 20130619122602A</guid></item><item><title>Closed Task: Revert DbLocalView made public [1059]</title><link>http://entityframework.codeplex.com/workitem/1059</link><description>These classes are now public&amp;#58; System.Data.Entity.Infrastructure.DbLocalView&amp;#60;TEntity&amp;#62;, System.Data.Entity.Infrastructure.ObjectReferenceEqualityComparer&lt;br /&gt;&lt;br /&gt;This property&amp;#39;s signature changed&amp;#58; DbLocalView&amp;#60;TEntity&amp;#62; DbSet&amp;#60;TEntity&amp;#62;.Local&lt;br /&gt;Comments: Verified code against the original change, no extra tests needed, closing</description><author>maumar</author><pubDate>Tue, 18 Jun 2013 23:49:27 GMT</pubDate><guid isPermaLink="false">Closed Task: Revert DbLocalView made public [1059] 20130618114927P</guid></item><item><title>Closed Task: Revert IDbSet.Local breaking change [1205]</title><link>http://entityframework.codeplex.com/workitem/1205</link><description>Based on discussion about Reference equality and the changes made to support it we decided to revert the change to the return type of DbSet.Local and IDbSet.Local. The returned type can also be made internal again.&lt;br /&gt;&lt;br /&gt;This is being done becauase&amp;#58;&lt;br /&gt;&amp;#42; It&amp;#39;s a breaking change to an interface that we have decided not to break for EF6&lt;br /&gt;&amp;#42; It only provides benefit in very limited situations--i.e. when the type is used directly&lt;br /&gt;Comments: Verified code against the original change, no extra tests needed, closing</description><author>maumar</author><pubDate>Tue, 18 Jun 2013 23:47:31 GMT</pubDate><guid isPermaLink="false">Closed Task: Revert IDbSet.Local breaking change [1205] 20130618114731P</guid></item><item><title>Created Unassigned: Stored Procs :: NullReferenceException when trying to scaffold migration for entity with Enum Key that is mapped to stored procedures [1277]</title><link>http://entityframework.codeplex.com/workitem/1277</link><description>Create the following model&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;namespace StoredProcsCustomize&lt;br /&gt;&amp;#123;&lt;br /&gt;    public enum MilitaryRank&lt;br /&gt;    &amp;#123;&lt;br /&gt;        Private,&lt;br /&gt;        Major,&lt;br /&gt;        Colonel,&lt;br /&gt;        General,&lt;br /&gt;    &amp;#125;&amp;#59;&lt;br /&gt;&lt;br /&gt;    public class EnumKey&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public MilitaryRank Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class MyContext &amp;#58; DbContext&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public DbSet&amp;#60;EnumKey&amp;#62; Keys &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;Enable-Migrations&lt;br /&gt;Add-Migration Mig1&lt;br /&gt;Update-Database&lt;br /&gt;&lt;br /&gt;now, add the following lines to the context&amp;#58;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;        protected override void OnModelCreating&amp;#40;DbModelBuilder modelBuilder&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            modelBuilder.Entity&amp;#60;EnumKey&amp;#62;&amp;#40;&amp;#41;.MapToStoredProcedures&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;Add-Migration Mig2&lt;br /&gt;&lt;br /&gt;throws the following exception&amp;#58;&lt;br /&gt;&lt;br /&gt;System.NullReferenceException&amp;#58; Object reference not set to an instance of an object.&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.ModificationCommandTreeGenerator.SetFakeReferenceKeyValues&amp;#40;Object entity, EntityType entityType&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.ModificationCommandTreeGenerator.&amp;#60;Generate&amp;#62;d__12&amp;#96;1.MoveNext&amp;#40;&amp;#41;&lt;br /&gt;   at System.Linq.Enumerable.WhereSelectEnumerableIterator&amp;#96;2.MoveNext&amp;#40;&amp;#41;&lt;br /&gt;   at System.Linq.Enumerable.&amp;#60;CastIterator&amp;#62;d__b1&amp;#96;1.MoveNext&amp;#40;&amp;#41;&lt;br /&gt;   at System.Linq.Buffer&amp;#96;1..ctor&amp;#40;IEnumerable&amp;#96;1 source&amp;#41;&lt;br /&gt;   at System.Linq.Enumerable.ToArray&amp;#91;TSource&amp;#93;&amp;#40;IEnumerable&amp;#96;1 source&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.GenerateFunctionBody&amp;#91;TCommandTree&amp;#93;&amp;#40;StorageEntityTypeModificationFunctionMapping modificationFunctionMapping, Func&amp;#96;3 treeGenerator, Lazy&amp;#96;1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String functionName, String rowsAffectedParameterName&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.GenerateInsertFunctionBody&amp;#40;StorageEntityTypeModificationFunctionMapping modificationFunctionMapping, Lazy&amp;#96;1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.&amp;#60;BuildCreateProcedureOperations&amp;#62;d__cd.MoveNext&amp;#40;&amp;#41;&lt;br /&gt;   at System.Linq.Enumerable.&amp;#60;SelectManyIterator&amp;#62;d__31&amp;#96;3.MoveNext&amp;#40;&amp;#41;&lt;br /&gt;   at System.Linq.Enumerable.&amp;#60;ConcatIterator&amp;#62;d__71&amp;#96;1.MoveNext&amp;#40;&amp;#41;&lt;br /&gt;   at System.Collections.Generic.List&amp;#96;1..ctor&amp;#40;IEnumerable&amp;#96;1 collection&amp;#41;&lt;br /&gt;   at System.Linq.Enumerable.ToList&amp;#91;TSource&amp;#93;&amp;#40;IEnumerable&amp;#96;1 source&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff&amp;#40;ModelMetadata source, ModelMetadata target, Lazy&amp;#96;1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff&amp;#40;XDocument sourceModel, XDocument targetModel, Lazy&amp;#96;1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.DbMigrator.Scaffold&amp;#40;String migrationName, String namespace, Boolean ignoreChanges&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold&amp;#40;String migrationName, Boolean ignoreChanges&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold&amp;#40;MigrationScaffolder scaffolder&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run&amp;#40;&amp;#41;&lt;br /&gt;   at System.AppDomain.DoCallBack&amp;#40;CrossAppDomainDelegate callBackDelegate&amp;#41;&lt;br /&gt;   at System.AppDomain.DoCallBack&amp;#40;CrossAppDomainDelegate callBackDelegate&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Design.ToolingFacade.Run&amp;#40;BaseRunner runner&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold&amp;#40;String migrationName, String language, String rootNamespace, Boolean ignoreChanges&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.AddMigrationCommand.Execute&amp;#40;String name, Boolean force, Boolean ignoreChanges&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.AddMigrationCommand.&amp;#60;&amp;#62;c__DisplayClass2.&amp;#60;.ctor&amp;#62;b__0&amp;#40;&amp;#41;&lt;br /&gt;   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute&amp;#40;Action command&amp;#41;&lt;br /&gt;</description><author>maumar</author><pubDate>Tue, 18 Jun 2013 23:38:43 GMT</pubDate><guid isPermaLink="false">Created Unassigned: Stored Procs :: NullReferenceException when trying to scaffold migration for entity with Enum Key that is mapped to stored procedures [1277] 20130618113843P</guid></item><item><title>Commented Unassigned: One to one issue in TPC hierarchy with mapped abstract base class [1229]</title><link>http://entityframework.codeplex.com/workitem/1229</link><description>Hi,&lt;br /&gt;    I have a TPC hierarchy like this&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;    public abstract class Base&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Guid BaseId &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string BaseName &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;    public class Sub1 &amp;#58; Base&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Sub2 Vender &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;    public class Sub2 &amp;#58; Base&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Sub1 Customer &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;    public class MyDbContext &amp;#58; DbContext&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public MyDbContext&amp;#40;&amp;#41;&lt;br /&gt;            &amp;#58; base&amp;#40;&amp;#34;name&amp;#61;db&amp;#34;&amp;#41;&lt;br /&gt;        &amp;#123; &amp;#125;&lt;br /&gt;&lt;br /&gt;        protected override void OnModelCreating&amp;#40;DbModelBuilder modelBuilder&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            base.OnModelCreating&amp;#40;modelBuilder&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Sub1&amp;#62;&amp;#40;&amp;#41;.HasRequired&amp;#40;x &amp;#61;&amp;#62; x.Vender&amp;#41;.WithOptional&amp;#40;x &amp;#61;&amp;#62; x.Customer&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Sub1&amp;#62;&amp;#40;&amp;#41;.Map&amp;#40;x &amp;#61;&amp;#62;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    x.ToTable&amp;#40;&amp;#34;Sub1s&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                    x.MapInheritedProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Sub2&amp;#62;&amp;#40;&amp;#41;.Map&amp;#40;x &amp;#61;&amp;#62;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    x.ToTable&amp;#40;&amp;#34;Sub2s&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                    x.MapInheritedProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        public DbSet&amp;#60;Base&amp;#62; People &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;Sub2&amp;#62; Venders &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;Sub1&amp;#62; Customers &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;Then I run the code and EF create tables &amp;#40;Sub1s and Sub2s&amp;#41;.&lt;br /&gt;But EF create an aditional Foreign Key for table Sub1, it do not use the Key of Sub1 as the Foreign Key..&lt;br /&gt;Comments: This type of mapping is supported in EDM&amp;#59; however, when the abstract base class in included in the model &amp;#40;via the &amp;#96;DbSet&amp;#60;Base&amp;#62;&amp;#96; property&amp;#41;, for some reason, Code First splits the primary key and foreign key into two columns.&amp;#13;&amp;#10;&amp;#13;&amp;#10;One workaround is to exclude &amp;#96;Base&amp;#96; from the model using &amp;#96;modelBuilder.Ignore&amp;#60;Base&amp;#62;&amp;#40;&amp;#41;&amp;#96;</description><author>BriceLambson</author><pubDate>Tue, 18 Jun 2013 23:24:37 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: One to one issue in TPC hierarchy with mapped abstract base class [1229] 20130618112437P</guid></item><item><title>Edited Unassigned: One to one issue in TPC hierarchy with mapped abstract base class [1229]</title><link>http://entityframework.codeplex.com/workitem/1229</link><description>Hi,&lt;br /&gt;    I have a TPC hierarchy like this&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;    public abstract class Base&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Guid BaseId &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string BaseName &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;    public class Sub1 &amp;#58; Base&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Sub2 Vender &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;    public class Sub2 &amp;#58; Base&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Sub1 Customer &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;    public class MyDbContext &amp;#58; DbContext&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public MyDbContext&amp;#40;&amp;#41;&lt;br /&gt;            &amp;#58; base&amp;#40;&amp;#34;name&amp;#61;db&amp;#34;&amp;#41;&lt;br /&gt;        &amp;#123; &amp;#125;&lt;br /&gt;&lt;br /&gt;        protected override void OnModelCreating&amp;#40;DbModelBuilder modelBuilder&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            base.OnModelCreating&amp;#40;modelBuilder&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Sub1&amp;#62;&amp;#40;&amp;#41;.HasRequired&amp;#40;x &amp;#61;&amp;#62; x.Vender&amp;#41;.WithOptional&amp;#40;x &amp;#61;&amp;#62; x.Customer&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Sub1&amp;#62;&amp;#40;&amp;#41;.Map&amp;#40;x &amp;#61;&amp;#62;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    x.ToTable&amp;#40;&amp;#34;Sub1s&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                    x.MapInheritedProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Sub2&amp;#62;&amp;#40;&amp;#41;.Map&amp;#40;x &amp;#61;&amp;#62;&lt;br /&gt;                &amp;#123;&lt;br /&gt;                    x.ToTable&amp;#40;&amp;#34;Sub2s&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                    x.MapInheritedProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        public DbSet&amp;#60;Base&amp;#62; People &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;Sub2&amp;#62; Venders &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;Sub1&amp;#62; Customers &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;Then I run the code and EF create tables &amp;#40;Sub1s and Sub2s&amp;#41;.&lt;br /&gt;But EF create an aditional Foreign Key for table Sub1, it do not use the Key of Sub1 as the Foreign Key..&lt;br /&gt;</description><author>BriceLambson</author><pubDate>Tue, 18 Jun 2013 23:24:37 GMT</pubDate><guid isPermaLink="false">Edited Unassigned: One to one issue in TPC hierarchy with mapped abstract base class [1229] 20130618112437P</guid></item><item><title>Commented Unassigned: ef migrations creates invalid default value for nullable string FK column [1275]</title><link>http://entityframework.codeplex.com/workitem/1275</link><description>say you have the following &amp;#40;in my case this is coming from edmx&amp;#41;&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;public partial class Currency&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#91;Key&amp;#93;&lt;br /&gt;&amp;#9;&amp;#91;Required&amp;#93;&lt;br /&gt;&amp;#9;&amp;#91;StringLength&amp;#40;3, MinimumLength &amp;#61; 3&amp;#41;&amp;#93;&lt;br /&gt;&amp;#9;&amp;#91;Column&amp;#40;TypeName &amp;#61; &amp;#34;char&amp;#34;&amp;#41;&amp;#93;&lt;br /&gt;&amp;#9;public string Code &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#91;InverseProperty&amp;#40;&amp;#34;Currency&amp;#34;&amp;#41;&amp;#93;&lt;br /&gt;&amp;#9;public virtual ICollection&amp;#60;Country&amp;#62; Countries &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public partial class Country&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#91;Key&amp;#93;&lt;br /&gt;&amp;#9;public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#91;Required&amp;#93;&lt;br /&gt;&amp;#9;public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;public virtual Currency Currency &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;notice that Country.Currency is nullable. however, EF migrations creates the column like this&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;    &amp;#91;Currency_Code&amp;#93; CHAR &amp;#40;3&amp;#41;       DEFAULT &amp;#40;&amp;#39;&amp;#39;&amp;#41; NULL,&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;so if you try to add the following&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;new Country &amp;#123;&lt;br /&gt;  Name &amp;#61; &amp;#34;Antarctica&amp;#34;,&lt;br /&gt;  Currency &amp;#61; null&lt;br /&gt;&amp;#125;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;you get a foreign key contraint exception because there&amp;#39;s no country with the Code &amp;#39;&amp;#39; - it should be inserting NULL by default.&lt;br /&gt;&lt;br /&gt;in fact, as far as i can tell, theres no way to insert NULL into such a column, because EF doesn&amp;#39;t specify null values in the insert, even if NULL isn&amp;#39;t the DEFAULT. The only time when it&amp;#39;s valid to omit the value from the INSERT is when the value in the entity is the same as the DEFAULT value - comparing to null is invalid in general.&lt;br /&gt;Comments: additionally, attempting to add the correct DEFAULT value with a custom migration fails&amp;#58;&amp;#10;&amp;#10;&amp;#96;&amp;#96;&amp;#96;&amp;#10;AlterColumn &amp;#40;&amp;#34;dbo.Countries&amp;#34;, &amp;#34;Currency_Code&amp;#34;, c &amp;#61;&amp;#62; c.String &amp;#40;maxLength&amp;#58; 3, fixedLength&amp;#58; true, unicode&amp;#58; false, defaultValue&amp;#58; null, defaultValueSql&amp;#58; &amp;#34;NULL&amp;#34;&amp;#41;&amp;#41;&amp;#59;&amp;#10;&amp;#96;&amp;#96;&amp;#96;&amp;#10;&amp;#10;fails with&amp;#58;&amp;#10;&amp;#96;&amp;#96;&amp;#96;&amp;#10;ALTER TABLE &amp;#91;dbo&amp;#93;.&amp;#91;Countries&amp;#93; ADD CONSTRAINT DF_Currency_Code DEFAULT NULL FOR &amp;#91;Currency_Code&amp;#93;&amp;#10;...&amp;#10;System.Data.SqlClient.SqlException &amp;#40;0x80131904&amp;#41;&amp;#58; Column already has a DEFAULT bound to it.&amp;#10;Could not create constraint.&amp;#10;&amp;#96;&amp;#96;&amp;#96;</description><author>spongman</author><pubDate>Tue, 18 Jun 2013 22:30:22 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: ef migrations creates invalid default value for nullable string FK column [1275] 20130618103022P</guid></item><item><title>Edited Unassigned: Migrations: Migrating from PK/FK to seperated out FK as an IA scaffold invalid migration [1244]</title><link>http://entityframework.codeplex.com/workitem/1244</link><description>Create the following model&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;    public class ArubaTask&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class ArubaRun&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public ICollection&amp;#60;ArubaTask&amp;#62; Tasks &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class ArubaContext &amp;#58; DbContext&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public DbSet&amp;#60;ArubaTask&amp;#62; Tasks &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;ArubaRun&amp;#62; Runs &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;        protected override void OnModelCreating&amp;#40;DbModelBuilder modelBuilder&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ArubaTask&amp;#62;&amp;#40;&amp;#41;.HasKey&amp;#40;k &amp;#61;&amp;#62; new &amp;#123; k.Id, k.Name &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;Enable-Migrations&lt;br /&gt;Add-Migration Mig1&lt;br /&gt;Update-Database&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ArubaTask.Id gets picked up as the FK &amp;#40;we&amp;#39;ve discussed this in the past and decided not to change the behavior - https&amp;#58;&amp;#47;&amp;#47;entityframework.codeplex.com&amp;#47;workitem&amp;#47;892&amp;#41;. But folks may want to add some config to add a separate FK column in the database.&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;modelBuilder.Entity&amp;#60;ArubaRun&amp;#62;&amp;#40;&amp;#41;.HasMany&amp;#40;r &amp;#61;&amp;#62; r.Tasks&amp;#41;.WithRequired&amp;#40;&amp;#41;.Map&amp;#40;m &amp;#61;&amp;#62; &amp;#123; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;If one does this before doing a first migration, everything works fine. However a migration from the first state to the new state generates this code&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;            RenameColumn&amp;#40;table&amp;#58; &amp;#34;dbo.ArubaTasks&amp;#34;, name&amp;#58; &amp;#34;Id&amp;#34;, newName&amp;#58; &amp;#34;ArubaRun_Id&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;            DropPrimaryKey&amp;#40;&amp;#34;dbo.ArubaTasks&amp;#34;, new&amp;#91;&amp;#93; &amp;#123; &amp;#34;Id&amp;#34;, &amp;#34;Name&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            AddPrimaryKey&amp;#40;&amp;#34;dbo.ArubaTasks&amp;#34;, new&amp;#91;&amp;#93; &amp;#123; &amp;#34;Id&amp;#34;, &amp;#34;Name&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;The PK column gets renamed and then the following calls refer to a column that no longer exists.&lt;br /&gt;&lt;br /&gt;The code is probably wrong too - it should really leave the PK column alone and create a new FK column.&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:43:27 GMT</pubDate><guid isPermaLink="false">Edited Unassigned: Migrations: Migrating from PK/FK to seperated out FK as an IA scaffold invalid migration [1244] 20130618094327P</guid></item><item><title>Created Issue: Query: Multiple deep includes not processed correctly [1276]</title><link>http://entityframework.codeplex.com/workitem/1276</link><description>This issue was originally reported via Connect - http&amp;#58;&amp;#47;&amp;#47;connect.microsoft.com&amp;#47;VisualStudio&amp;#47;feedback&amp;#47;details&amp;#47;789804&amp;#47;ef-not-loading-collection-when-using-include&lt;br /&gt;&lt;br /&gt;The query in question has a number of includes that specify multi-level paths, the relationships in question are also quite cyclical.&lt;br /&gt;&lt;br /&gt;Here is a simplified repro - the second assert fails.&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;using System.Collections.Generic&amp;#59;&lt;br /&gt;using System.ComponentModel.DataAnnotations.Schema&amp;#59;&lt;br /&gt;using System.Data.Entity&amp;#59;&lt;br /&gt;using System.Diagnostics&amp;#59;&lt;br /&gt;using System.Linq&amp;#59;&lt;br /&gt;&lt;br /&gt;namespace ConsoleApplication3&lt;br /&gt;&amp;#123;&lt;br /&gt;    class Program&lt;br /&gt;    &amp;#123;&lt;br /&gt;        static void Main&amp;#40;string&amp;#91;&amp;#93; args&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            Database.SetInitializer&amp;#40;new TestContextInitializer&amp;#40;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            using &amp;#40;TestContext context &amp;#61; new TestContext&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                context.Configuration.LazyLoadingEnabled &amp;#61; false&amp;#59;&lt;br /&gt;&lt;br /&gt;                Master master &amp;#61; context.Masters&lt;br /&gt;                            .Where&amp;#40;m &amp;#61;&amp;#62; m.Name &amp;#61;&amp;#61; &amp;#34;Master1&amp;#34;&amp;#41;&lt;br /&gt;                            .Include&amp;#40;&amp;#34;Query.ChildrenA&amp;#34;&amp;#41;&lt;br /&gt;                            .Include&amp;#40;&amp;#34;Query.ChildrenB.SpecialQuery.ChildrenA&amp;#34;&amp;#41;&lt;br /&gt;                            .Include&amp;#40;&amp;#34;Query.ChildrenB.SpecialQuery.ChildrenB&amp;#34;&amp;#41;&lt;br /&gt;                            .First&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                ChildB c &amp;#61; master.Query.GetChildByName&amp;#40;&amp;#34;ChildB3&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;                &amp;#47;&amp;#47; Second Assert Fails&lt;br /&gt;                Debug.Assert&amp;#40;c.SpecialQuery.ChildrenA.Count &amp;#61;&amp;#61; 1&amp;#41;&amp;#59;&lt;br /&gt;                Debug.Assert&amp;#40;c.SpecialQuery.ChildrenB.Count &amp;#61;&amp;#61; 4&amp;#41;&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class Master&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public virtual Query Query &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class Query&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public Query&amp;#40;&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            ChildrenA &amp;#61; new HashSet&amp;#60;ChildA&amp;#62;&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            ChildrenB &amp;#61; new HashSet&amp;#60;ChildB&amp;#62;&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;        public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public Master Master &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public ChildB SpecialChild &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public virtual ICollection&amp;#60;ChildA&amp;#62; ChildrenA &amp;#123; get&amp;#59; private set&amp;#59; &amp;#125;&lt;br /&gt;        public virtual ICollection&amp;#60;ChildB&amp;#62; ChildrenB &amp;#123; get&amp;#59; private set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;        public ChildB GetChildByName&amp;#40;string name&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            return ChildrenB.Where&amp;#40;c &amp;#61;&amp;#62; c.Name &amp;#61;&amp;#61; name&amp;#41;.FirstOrDefault&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class ChildA&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public int Query_Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public virtual Query Query &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class ChildB&lt;br /&gt;    &amp;#123;&lt;br /&gt;        public int Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public string Name &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public virtual Query SpecialQuery &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public int Query_Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public Query Query &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class TestContext &amp;#58; DbContext&lt;br /&gt;    &amp;#123;&lt;br /&gt;        protected override void OnModelCreating&amp;#40;DbModelBuilder modelBuilder&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            base.OnModelCreating&amp;#40;modelBuilder&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Master&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .Property&amp;#40;m &amp;#61;&amp;#62; m.Id&amp;#41;&lt;br /&gt;                .HasDatabaseGeneratedOption&amp;#40;DatabaseGeneratedOption.Identity&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Master&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasKey&amp;#40;m &amp;#61;&amp;#62; m.Id&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Query&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .Property&amp;#40;q &amp;#61;&amp;#62; q.Id&amp;#41;&lt;br /&gt;                .HasDatabaseGeneratedOption&amp;#40;DatabaseGeneratedOption.Identity&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Query&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasKey&amp;#40;q &amp;#61;&amp;#62; q.Id&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Query&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasOptional&amp;#40;q &amp;#61;&amp;#62; q.Master&amp;#41;&lt;br /&gt;                .WithOptionalPrincipal&amp;#40;m &amp;#61;&amp;#62; m.Query&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;Query&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasOptional&amp;#40;q &amp;#61;&amp;#62; q.SpecialChild&amp;#41;&lt;br /&gt;                .WithOptionalPrincipal&amp;#40;c &amp;#61;&amp;#62; c.SpecialQuery&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ChildA&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .Property&amp;#40;c &amp;#61;&amp;#62; c.Id&amp;#41;&lt;br /&gt;                .HasDatabaseGeneratedOption&amp;#40;DatabaseGeneratedOption.Identity&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ChildA&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasKey&amp;#40;c &amp;#61;&amp;#62; new &amp;#123; c.Query_Id, c.Id &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ChildA&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasRequired&amp;#40;c &amp;#61;&amp;#62; c.Query&amp;#41;&lt;br /&gt;                .WithMany&amp;#40;q &amp;#61;&amp;#62; q.ChildrenA&amp;#41;&lt;br /&gt;                .HasForeignKey&amp;#40;c &amp;#61;&amp;#62; c.Query_Id&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ChildB&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .Property&amp;#40;c &amp;#61;&amp;#62; c.Id&amp;#41;&lt;br /&gt;                .HasDatabaseGeneratedOption&amp;#40;DatabaseGeneratedOption.Identity&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ChildB&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasKey&amp;#40;c &amp;#61;&amp;#62; new &amp;#123; c.Query_Id, c.Id &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            modelBuilder.Entity&amp;#60;ChildB&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .HasRequired&amp;#40;c &amp;#61;&amp;#62; c.Query&amp;#41;&lt;br /&gt;                .WithMany&amp;#40;m &amp;#61;&amp;#62; m.ChildrenB&amp;#41;&lt;br /&gt;                .HasForeignKey&amp;#40;c &amp;#61;&amp;#62; c.Query_Id&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        public DbSet&amp;#60;Master&amp;#62; Masters &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;ChildA&amp;#62; ChildrenA &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;        public DbSet&amp;#60;ChildB&amp;#62; ChildrenB &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;    public class TestContextInitializer &amp;#58; DropCreateDatabaseAlways&amp;#60;TestContext&amp;#62;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        protected override void Seed&amp;#40;TestContext context&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            Master master &amp;#61; new Master&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;Master1&amp;#34;, Query &amp;#61; new Query&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;Query1&amp;#34; &amp;#125; &amp;#125;&amp;#59;&lt;br /&gt;            master.Query.ChildrenA.Add&amp;#40;new ChildA&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;ChildA1&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            master.Query.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;ChildB1&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            master.Query.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;ChildB2&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            master.Query.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;ChildB3&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            master.Query.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;ChildB4&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            context.Masters.Add&amp;#40;master&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            Query special &amp;#61; new Query&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;Special&amp;#34; &amp;#125;&amp;#59;&lt;br /&gt;            ChildB c3 &amp;#61; master.Query.GetChildByName&amp;#40;&amp;#34;ChildB3&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;            c3.SpecialQuery &amp;#61; special&amp;#59;&lt;br /&gt;            special.ChildrenA.Add&amp;#40;new ChildA&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;SpecialChildA1&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            special.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;SpecialChildB1&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            special.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;SpecialChildB2&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            special.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;SpecialChildB3&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            special.ChildrenB.Add&amp;#40;new ChildB&amp;#40;&amp;#41; &amp;#123; Name &amp;#61; &amp;#34;SpecialChildB4&amp;#34; &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            context.SaveChanges&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:26:48 GMT</pubDate><guid isPermaLink="false">Created Issue: Query: Multiple deep includes not processed correctly [1276] 20130618092648P</guid></item><item><title>Edited Unassigned: Bad error message for .HasInverseEndMultiplicity() on out of range enum [1213]</title><link>http://entityframework.codeplex.com/workitem/1213</link><description>1. New console application&lt;br /&gt;2. PM&amp;#62; Install-package entityframework -pre -version 6.0.0-beta1-20531&lt;br /&gt;3. replace Program.cs with attached file&lt;br /&gt;4. Debug the application &amp;#40;F5&amp;#41; &lt;br /&gt;NOTE&amp;#58; Exception is thrown&lt;br /&gt;Also note, that this exception is thrown with a correctly formatted values for .HasRelationshipMultiplicity&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;Error&amp;#58;&lt;br /&gt;    Schema specified is not valid. Errors&amp;#58; &lt;br /&gt;    &amp;#40;0,0&amp;#41; &amp;#58; error 0005&amp;#58; The &amp;#39;Multiplicity&amp;#39; attribute is invalid - The value &amp;#39;&amp;#39; is invalid according to its datatype &amp;#39;http&amp;#58;&amp;#47;&amp;#47;schemas.microsoft.com&amp;#47;ado&amp;#47;2009&amp;#47;11&amp;#47;edm&amp;#58;TMultiplicity&amp;#39; - The Enumeration constraint failed.&lt;br /&gt;    &amp;#40;0,0&amp;#41; &amp;#58; error 0092&amp;#58; Relationship Comment_Parent is not valid. Multiplicity &amp;#40;&amp;#41; is not valid. Multiplicity must be&amp;#58; &amp;#39;&amp;#42;&amp;#39;, &amp;#39;0..1&amp;#39;, or &amp;#39;1&amp;#39;.&lt;br /&gt;&lt;br /&gt;Convention&amp;#58;&lt;br /&gt;                modelBuilder.Types&amp;#60;Comment&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .Configure&amp;#40;c &amp;#61;&amp;#62; c                &lt;br /&gt;                .NavigationProperty&amp;#40;t &amp;#61;&amp;#62; t.Parent&amp;#41;&lt;br /&gt;                    .HasInverseEndMultiplicity&amp;#40;&amp;#40;RelationshipMultiplicity&amp;#41; 7&amp;#41;&lt;br /&gt;                &amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:15:14 GMT</pubDate><guid isPermaLink="false">Edited Unassigned: Bad error message for .HasInverseEndMultiplicity() on out of range enum [1213] 20130618091514P</guid></item><item><title>Closed Unassigned: Bad error message for .HasInverseEndMultiplicity() on out of range enum [1213]</title><link>http://entityframework.codeplex.com/workitem/1213</link><description>1. New console application&lt;br /&gt;2. PM&amp;#62; Install-package entityframework -pre -version 6.0.0-beta1-20531&lt;br /&gt;3. replace Program.cs with attached file&lt;br /&gt;4. Debug the application &amp;#40;F5&amp;#41; &lt;br /&gt;NOTE&amp;#58; Exception is thrown&lt;br /&gt;Also note, that this exception is thrown with a correctly formatted values for .HasRelationshipMultiplicity&amp;#40;&amp;#41;&lt;br /&gt;&lt;br /&gt;Error&amp;#58;&lt;br /&gt;    Schema specified is not valid. Errors&amp;#58; &lt;br /&gt;    &amp;#40;0,0&amp;#41; &amp;#58; error 0005&amp;#58; The &amp;#39;Multiplicity&amp;#39; attribute is invalid - The value &amp;#39;&amp;#39; is invalid according to its datatype &amp;#39;http&amp;#58;&amp;#47;&amp;#47;schemas.microsoft.com&amp;#47;ado&amp;#47;2009&amp;#47;11&amp;#47;edm&amp;#58;TMultiplicity&amp;#39; - The Enumeration constraint failed.&lt;br /&gt;    &amp;#40;0,0&amp;#41; &amp;#58; error 0092&amp;#58; Relationship Comment_Parent is not valid. Multiplicity &amp;#40;&amp;#41; is not valid. Multiplicity must be&amp;#58; &amp;#39;&amp;#42;&amp;#39;, &amp;#39;0..1&amp;#39;, or &amp;#39;1&amp;#39;.&lt;br /&gt;&lt;br /&gt;Convention&amp;#58;&lt;br /&gt;                modelBuilder.Types&amp;#60;Comment&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                .Configure&amp;#40;c &amp;#61;&amp;#62; c                &lt;br /&gt;                .NavigationProperty&amp;#40;t &amp;#61;&amp;#62; t.Parent&amp;#41;&lt;br /&gt;                    .HasInverseEndMultiplicity&amp;#40;&amp;#40;RelationshipMultiplicity&amp;#41; 7&amp;#41;&lt;br /&gt;                &amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;Comments: __EF Team Triage&amp;#58;__ This isn&amp;#39;t really a scenario that folks would hit, you&amp;#39;d have to try pretty hard to see hit this. The current error is fine if you do hit it.</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:15:14 GMT</pubDate><guid isPermaLink="false">Closed Unassigned: Bad error message for .HasInverseEndMultiplicity() on out of range enum [1213] 20130618091514P</guid></item><item><title>Edited Unassigned: DbSet&lt;T&gt;.Remove(entity) sets navigation properties to null even if SaveChanges failed [1228]</title><link>http://entityframework.codeplex.com/workitem/1228</link><description>The deletion of entities can fail because of foreign key constraints, connection failures or trigger interaction. In this case navigation properties are set to null by DbSet&amp;#60;T&amp;#62;.Remove&amp;#40;entity&amp;#41; leaving the object graph in a DbContext in an unrecoverable state.&lt;br /&gt;This behaviour leads to problems in applications which use a longer living DbContext like WPF applications. Here a DbContext can live throughout the live time of a window displaying an entity or entity graph. &lt;br /&gt;E.g. an invoice with its line items is displayed in a wpf window bound to entity properties. If the deletion of the invoice failed all navigation properties of the entity are still set to null.&lt;br /&gt;Thus, I would like to propose the following features to solve this situation&amp;#58;&lt;br /&gt;&lt;br /&gt;1. Association OnDelete action&lt;br /&gt;In EF 5 &amp;#38; 6 the action of associations can be set to &amp;#34;None&amp;#34; or &amp;#34;Cascade&amp;#34; &amp;#40;WillCascadeOnDelete&amp;#41; for both ends in the model designer. The current behaviour of &amp;#34;None&amp;#34; resembles more the &amp;#34;Set Null&amp;#34; behaviour of the SQL Server.&lt;br /&gt;Thus, it would be great if the action could be set to &amp;#8220;None&amp;#8221; and &amp;#8220;Set Null&amp;#8221; controlling the association more precisely.&lt;br /&gt;&lt;br /&gt;2. Foreign key constraints&lt;br /&gt;In the case of a &amp;#34;None&amp;#34; OnDelete action the DbSet&amp;#60;T&amp;#62;.Remove&amp;#40;entity&amp;#41; should throw an exception if an entity can&amp;#8217;t be deleted leaving the navigation properties untouched. With this approach the object graph would still be valid. As the graph could be loaded only partially, the decision if an entity can be deleted is not final but can be calculated for the partial graph.&lt;br /&gt;&lt;br /&gt;3. Setting navigation properties to null&lt;br /&gt;With 1. &amp;#38; 2. Foreign key constraints are covered. However, there can be still the case that a delete operation fail because of a lost connection, foreign key constraints beyond the loaded entity graph or other database constraints like triggers which are invisible to the EF.&lt;br /&gt;In this case all navigation properties are lost and the entity can&amp;#8217;t be used anymore for displaying data, like in the case of WPF bindings. There are a couple of possible solutions for this situation&amp;#58; The simplest one would be to set navigation properties to &amp;#34;null&amp;#8221; only after a successful SaveChanges call. This is somehow inconsistent with property changes to entities which are applied instantaneously.&lt;br /&gt;Another approach would be an implementation of IEditableObject in an entity base class leaving the restoring of entities after a failed deletion up to the developer and not the EF framework. In this case the entity has to be notified before removing it from the DbSet. A virtual &amp;#34;RemoveEntity&amp;#34; method in the DbContext like the &amp;#34;SaveChanges&amp;#34; could enable this approach.&lt;br /&gt;&lt;br /&gt;If there are other solutions of this problem let me know.&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:14:00 GMT</pubDate><guid isPermaLink="false">Edited Unassigned: DbSet&lt;T&gt;.Remove(entity) sets navigation properties to null even if SaveChanges failed [1228] 20130618091400P</guid></item><item><title>Closed Unassigned: DbSet&lt;T&gt;.Remove(entity) sets navigation properties to null even if SaveChanges failed [1228]</title><link>http://entityframework.codeplex.com/workitem/1228</link><description>The deletion of entities can fail because of foreign key constraints, connection failures or trigger interaction. In this case navigation properties are set to null by DbSet&amp;#60;T&amp;#62;.Remove&amp;#40;entity&amp;#41; leaving the object graph in a DbContext in an unrecoverable state.&lt;br /&gt;This behaviour leads to problems in applications which use a longer living DbContext like WPF applications. Here a DbContext can live throughout the live time of a window displaying an entity or entity graph. &lt;br /&gt;E.g. an invoice with its line items is displayed in a wpf window bound to entity properties. If the deletion of the invoice failed all navigation properties of the entity are still set to null.&lt;br /&gt;Thus, I would like to propose the following features to solve this situation&amp;#58;&lt;br /&gt;&lt;br /&gt;1. Association OnDelete action&lt;br /&gt;In EF 5 &amp;#38; 6 the action of associations can be set to &amp;#34;None&amp;#34; or &amp;#34;Cascade&amp;#34; &amp;#40;WillCascadeOnDelete&amp;#41; for both ends in the model designer. The current behaviour of &amp;#34;None&amp;#34; resembles more the &amp;#34;Set Null&amp;#34; behaviour of the SQL Server.&lt;br /&gt;Thus, it would be great if the action could be set to &amp;#8220;None&amp;#8221; and &amp;#8220;Set Null&amp;#8221; controlling the association more precisely.&lt;br /&gt;&lt;br /&gt;2. Foreign key constraints&lt;br /&gt;In the case of a &amp;#34;None&amp;#34; OnDelete action the DbSet&amp;#60;T&amp;#62;.Remove&amp;#40;entity&amp;#41; should throw an exception if an entity can&amp;#8217;t be deleted leaving the navigation properties untouched. With this approach the object graph would still be valid. As the graph could be loaded only partially, the decision if an entity can be deleted is not final but can be calculated for the partial graph.&lt;br /&gt;&lt;br /&gt;3. Setting navigation properties to null&lt;br /&gt;With 1. &amp;#38; 2. Foreign key constraints are covered. However, there can be still the case that a delete operation fail because of a lost connection, foreign key constraints beyond the loaded entity graph or other database constraints like triggers which are invisible to the EF.&lt;br /&gt;In this case all navigation properties are lost and the entity can&amp;#8217;t be used anymore for displaying data, like in the case of WPF bindings. There are a couple of possible solutions for this situation&amp;#58; The simplest one would be to set navigation properties to &amp;#34;null&amp;#8221; only after a successful SaveChanges call. This is somehow inconsistent with property changes to entities which are applied instantaneously.&lt;br /&gt;Another approach would be an implementation of IEditableObject in an entity base class leaving the restoring of entities after a failed deletion up to the developer and not the EF framework. In this case the entity has to be notified before removing it from the DbSet. A virtual &amp;#34;RemoveEntity&amp;#34; method in the DbContext like the &amp;#34;SaveChanges&amp;#34; could enable this approach.&lt;br /&gt;&lt;br /&gt;If there are other solutions of this problem let me know.&lt;br /&gt;Comments: __EF Team Triage&amp;#58;__ We discussed this one at length but ultimately decided it&amp;#39;s not something we would change. The context is not transactional and we don&amp;#39;t try to provide a mechanism to roll back to the state of the context before you made changes. Allowing relationships to be set back to their original value when a save fails &amp;#40;or delaying setting to null until the save completes&amp;#41; is just one part of rolling back from a failed save and we wouldn&amp;#39;t want to deal with just this one case. Given the size and complexity of this change it&amp;#39;s not something we&amp;#39;re going to consider.</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:14:00 GMT</pubDate><guid isPermaLink="false">Closed Unassigned: DbSet&lt;T&gt;.Remove(entity) sets navigation properties to null even if SaveChanges failed [1228] 20130618091400P</guid></item><item><title>Edited Unassigned: No XML documentation generated for the mergeOption parameter [1230]</title><link>http://entityframework.codeplex.com/workitem/1230</link><description>In EF 5, when generating the XML documentation for the function imports, the description of the mergeOption parameter is always left empty.&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:06:54 GMT</pubDate><guid isPermaLink="false">Edited Unassigned: No XML documentation generated for the mergeOption parameter [1230] 20130618090654P</guid></item><item><title>Closed Unassigned: No XML documentation generated for the mergeOption parameter [1230]</title><link>http://entityframework.codeplex.com/workitem/1230</link><description>In EF 5, when generating the XML documentation for the function imports, the description of the mergeOption parameter is always left empty.&lt;br /&gt;Comments: __EF Team Triage&amp;#58;__ We discussed but aren&amp;#39;t planning to fix this given the relatively low benefit it provides. We would consider accepting a pull request that adds it in.</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:06:54 GMT</pubDate><guid isPermaLink="false">Closed Unassigned: No XML documentation generated for the mergeOption parameter [1230] 20130618090654P</guid></item><item><title>Edited Issue: IAs configured in Code First between entities in same TPC hierarchy cause MappingExceptions [1232]</title><link>http://entityframework.codeplex.com/workitem/1232</link><description>See CodePlex discussion here&amp;#58; https&amp;#58;&amp;#47;&amp;#47;entityframework.codeplex.com&amp;#47;discussions&amp;#47;445686&lt;br /&gt;&lt;br /&gt;We throw a MappingException as part of view generation when there is an IA configured between two types in a TPC hierarchy--between Media and MediaDocument in this case. It is not clear if this is a limitation in EF mapping or a Code First issue so we should investigate to find out. The workaround is to use an FK relationship.&lt;br /&gt;&lt;br /&gt;Full code to repro. &amp;#40;Note that just building the model doesn&amp;#39;t throw--you have to get view generation to happen as well.&amp;#41;&lt;br /&gt;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;class Program&lt;br /&gt;&amp;#123;&lt;br /&gt;    static void Main&amp;#40;string&amp;#91;&amp;#93; args&amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        using &amp;#40;var context &amp;#61; new MediaContext&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            context.Database.Delete&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            var doc &amp;#61; context.MediaDocuments.Add&amp;#40;new MediaDocument &amp;#123; MediaId &amp;#61; 2 &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;            doc.MediaDocument &amp;#61; doc&amp;#59;&lt;br /&gt;            context.Media.Add&amp;#40;new Media &amp;#123; MediaId &amp;#61; 1, MediaDocument &amp;#61; doc &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;            context.SaveChanges&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        using &amp;#40;var context &amp;#61; new MediaContext&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            foreach &amp;#40;var media in context.Media.Include&amp;#40;m &amp;#61;&amp;#62; m.MediaDocument&amp;#41;&amp;#41;&lt;br /&gt;            &amp;#123;&lt;br /&gt;                Console.WriteLine&amp;#40;&amp;#34;&amp;#123;0&amp;#125; with &amp;#123;1&amp;#125;&amp;#34;, media.MediaId, media.MediaDocument.MediaId&amp;#41;&amp;#59;&lt;br /&gt;            &amp;#125;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public class MediaContext &amp;#58; DbContext&lt;br /&gt;&amp;#123;&lt;br /&gt;    public DbSet&amp;#60;MediaDocument&amp;#62; MediaDocuments &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    public DbSet&amp;#60;Media&amp;#62; Media &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;    protected override void OnModelCreating&amp;#40;DbModelBuilder modelBuilder&amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        modelBuilder.Entity&amp;#60;MediaDocument&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                    .Map&amp;#40;m &amp;#61;&amp;#62;&lt;br /&gt;                        &amp;#123;&lt;br /&gt;                            m.MapInheritedProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;                            m.ToTable&amp;#40;&amp;#34;MediaDocument&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;                        &amp;#125;&amp;#41;&amp;#59;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public class MediaDocument &amp;#58; Media&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public partial class Media&lt;br /&gt;&amp;#123;&lt;br /&gt;    public int MediaId &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&lt;br /&gt;    &amp;#47;&amp;#47; Uncomment this line to workaround the issue&lt;br /&gt;    &amp;#47;&amp;#47; public int&amp;#63; MediaDocumentMediaId &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    public virtual MediaDocument MediaDocument &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:05:02 GMT</pubDate><guid isPermaLink="false">Edited Issue: IAs configured in Code First between entities in same TPC hierarchy cause MappingExceptions [1232] 20130618090502P</guid></item><item><title>Edited Issue: An exception when I handle inheritance with EF code first [1206]</title><link>http://entityframework.codeplex.com/workitem/1206</link><description>When I handle inheritance with EF code first, I hit an exception. My code like this&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;public abstract class ProjectOwner&lt;br /&gt;&amp;#123;&lt;br /&gt;    &amp;#91;key&amp;#93;&lt;br /&gt;    public string Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    ...&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#91;Table&amp;#40;&amp;#34;Organizations&amp;#34;&amp;#41;&amp;#93;&lt;br /&gt;public class Organization &amp;#58; ProjectOwner&lt;br /&gt;&amp;#123;&lt;br /&gt;    ...&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#91;Table&amp;#40;&amp;#34;Users&amp;#34;&amp;#41;&amp;#93;&lt;br /&gt;public class User &amp;#58; ProjectOwner&lt;br /&gt;&amp;#123;&lt;br /&gt;    ...&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public class Context &amp;#58; DbContext&lt;br /&gt;&amp;#123;&lt;br /&gt;    public DbSet&amp;#60;User&amp;#62; Users &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    public DbSet&amp;#60;Organization&amp;#62; Organizations &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public User FindUserById&amp;#40;userId&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;    var context &amp;#61; new Context&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;    return context.Users.Find&amp;#40;userId&amp;#41;&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;I found that, when I find an user with userId, it will find the userId in ProjectOwners table. So, it may find a ProjectOwner object whose id is the same as the userId. Then, it will try to convert the ProjectOwner object to UserObject to return. Due to the actual ProjectOwner object may be an Organization not an User, it will raise an exception&amp;#58; &lt;br /&gt;&amp;#62;The specified cast from a materialized &amp;#39;System.Data.Entity.DynamicProxies.Organization_0D12134520D0F1937F8CB863E385A76833296BFEB7AD53A881C510B5B2C68008&amp;#39; type to the &amp;#39;User&amp;#39; type is not valid.&lt;br /&gt;&lt;br /&gt;That&amp;#39;s very strange, my code is context.Users.Find&amp;#40;&amp;#41; not context.ProjectOwners.Find&amp;#40;&amp;#41;, why not find in Users table only&amp;#63; &lt;br /&gt;&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:04:26 GMT</pubDate><guid isPermaLink="false">Edited Issue: An exception when I handle inheritance with EF code first [1206] 20130618090426P</guid></item><item><title>Commented Issue: An exception when I handle inheritance with EF code first [1206]</title><link>http://entityframework.codeplex.com/workitem/1206</link><description>When I handle inheritance with EF code first, I hit an exception. My code like this&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;public abstract class ProjectOwner&lt;br /&gt;&amp;#123;&lt;br /&gt;    &amp;#91;key&amp;#93;&lt;br /&gt;    public string Id &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    ...&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#91;Table&amp;#40;&amp;#34;Organizations&amp;#34;&amp;#41;&amp;#93;&lt;br /&gt;public class Organization &amp;#58; ProjectOwner&lt;br /&gt;&amp;#123;&lt;br /&gt;    ...&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#91;Table&amp;#40;&amp;#34;Users&amp;#34;&amp;#41;&amp;#93;&lt;br /&gt;public class User &amp;#58; ProjectOwner&lt;br /&gt;&amp;#123;&lt;br /&gt;    ...&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public class Context &amp;#58; DbContext&lt;br /&gt;&amp;#123;&lt;br /&gt;    public DbSet&amp;#60;User&amp;#62; Users &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;    public DbSet&amp;#60;Organization&amp;#62; Organizations &amp;#123; get&amp;#59; set&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;public User FindUserById&amp;#40;userId&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;    var context &amp;#61; new Context&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;    return context.Users.Find&amp;#40;userId&amp;#41;&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;I found that, when I find an user with userId, it will find the userId in ProjectOwners table. So, it may find a ProjectOwner object whose id is the same as the userId. Then, it will try to convert the ProjectOwner object to UserObject to return. Due to the actual ProjectOwner object may be an Organization not an User, it will raise an exception&amp;#58; &lt;br /&gt;&amp;#62;The specified cast from a materialized &amp;#39;System.Data.Entity.DynamicProxies.Organization_0D12134520D0F1937F8CB863E385A76833296BFEB7AD53A881C510B5B2C68008&amp;#39; type to the &amp;#39;User&amp;#39; type is not valid.&lt;br /&gt;&lt;br /&gt;That&amp;#39;s very strange, my code is context.Users.Find&amp;#40;&amp;#41; not context.ProjectOwners.Find&amp;#40;&amp;#41;, why not find in Users table only&amp;#63; &lt;br /&gt;&lt;br /&gt;Comments: __EF Team Triage&amp;#58;__ We discussed and agreed that it may be better just to return null. Given that this requires a bit more discussion&amp;#47;design and that we aren&amp;#39;t starting any new feature work in EF6 &amp;#40;just focusing on fixing bugs&amp;#41; we&amp;#39;re moving this to the Future release to consider post-EF6.</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:04:19 GMT</pubDate><guid isPermaLink="false">Commented Issue: An exception when I handle inheritance with EF code first [1206] 20130618090419P</guid></item><item><title>Commented Unassigned: Convention support for naming foreign key columns [1226]</title><link>http://entityframework.codeplex.com/workitem/1226</link><description>I&amp;#39;ve spent some time going through the EF 6 source code, and looking for examples, and I&amp;#39;ve concluded that it&amp;#39;s not currently possible to configure foreign key columns using a custom convention.&lt;br /&gt;&lt;br /&gt;I can do this for each association without a foreign key property &amp;#40;which I think is named an independent association&amp;#41;&amp;#58;&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;data&amp;#47;jj591620.aspx&amp;#35;IndependentAssociation&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96; C&amp;#35;&lt;br /&gt;modelBuilder.Entity&amp;#60;Course&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;    .HasRequired&amp;#40;c &amp;#61;&amp;#62; c.Department&amp;#41;&lt;br /&gt;    .WithMany&amp;#40;t &amp;#61;&amp;#62; t.Courses&amp;#41;&lt;br /&gt;    .Map&amp;#40;m &amp;#61;&amp;#62; m.MapKey&amp;#40;&amp;#34;ChangedDepartmentID&amp;#34;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;where the &amp;#96;MapKey&amp;#40;params string&amp;#91;&amp;#93; columnNames&amp;#41;&amp;#96; is the call that I&amp;#39;m really missing in conventions.&lt;br /&gt;&lt;br /&gt;Here&amp;#39;s the best that I can figure out&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96; C&amp;#35;&lt;br /&gt;public class AbsentForeignKeyNamingConvention &amp;#58; IConfigurationConvention&amp;#60;PropertyInfo, NavigationPropertyConfiguration&amp;#62;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;public void Apply&amp;#40;PropertyInfo memberInfo, Func&amp;#60;NavigationPropertyConfiguration&amp;#62; configuration, ModelConfiguration modelConfiguration&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;ForeignKeyConstraintConfiguration fkConfig &amp;#61; new ForeignKeyConstraintConfiguration&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;fkConfig.AddColumn&amp;#40;propertyInfo&amp;#41;&amp;#59; &amp;#47;&amp;#47; &amp;#60;&amp;#60; Requires a PropertyInfo, I can&amp;#39;t pass in a column name...&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;configuration&amp;#40;&amp;#41;.Constraint &amp;#61; fkConfig&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;It&amp;#39;s possible this can be completed with other types of conventions, but I haven&amp;#39;t been able to figure it out yet.&lt;br /&gt;Comments: __EF Team Triage&amp;#58;__ There should be a way to do this currently &amp;#40;possibly from the lighter weight conventions&amp;#41;. Luke can you take a look and post some code that shows how to do this.</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:02:08 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: Convention support for naming foreign key columns [1226] 20130618090208P</guid></item><item><title>Edited Unassigned: Convention support for naming foreign key columns [1226]</title><link>http://entityframework.codeplex.com/workitem/1226</link><description>I&amp;#39;ve spent some time going through the EF 6 source code, and looking for examples, and I&amp;#39;ve concluded that it&amp;#39;s not currently possible to configure foreign key columns using a custom convention.&lt;br /&gt;&lt;br /&gt;I can do this for each association without a foreign key property &amp;#40;which I think is named an independent association&amp;#41;&amp;#58;&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;data&amp;#47;jj591620.aspx&amp;#35;IndependentAssociation&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96; C&amp;#35;&lt;br /&gt;modelBuilder.Entity&amp;#60;Course&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;    .HasRequired&amp;#40;c &amp;#61;&amp;#62; c.Department&amp;#41;&lt;br /&gt;    .WithMany&amp;#40;t &amp;#61;&amp;#62; t.Courses&amp;#41;&lt;br /&gt;    .Map&amp;#40;m &amp;#61;&amp;#62; m.MapKey&amp;#40;&amp;#34;ChangedDepartmentID&amp;#34;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;where the &amp;#96;MapKey&amp;#40;params string&amp;#91;&amp;#93; columnNames&amp;#41;&amp;#96; is the call that I&amp;#39;m really missing in conventions.&lt;br /&gt;&lt;br /&gt;Here&amp;#39;s the best that I can figure out&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96; C&amp;#35;&lt;br /&gt;public class AbsentForeignKeyNamingConvention &amp;#58; IConfigurationConvention&amp;#60;PropertyInfo, NavigationPropertyConfiguration&amp;#62;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#9;public void Apply&amp;#40;PropertyInfo memberInfo, Func&amp;#60;NavigationPropertyConfiguration&amp;#62; configuration, ModelConfiguration modelConfiguration&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;ForeignKeyConstraintConfiguration fkConfig &amp;#61; new ForeignKeyConstraintConfiguration&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;fkConfig.AddColumn&amp;#40;propertyInfo&amp;#41;&amp;#59; &amp;#47;&amp;#47; &amp;#60;&amp;#60; Requires a PropertyInfo, I can&amp;#39;t pass in a column name...&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;configuration&amp;#40;&amp;#41;.Constraint &amp;#61; fkConfig&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;&lt;br /&gt;It&amp;#39;s possible this can be completed with other types of conventions, but I haven&amp;#39;t been able to figure it out yet.&lt;br /&gt;</description><author>RoMiller</author><pubDate>Tue, 18 Jun 2013 21:02:08 GMT</pubDate><guid isPermaLink="false">Edited Unassigned: Convention support for naming foreign key columns [1226] 20130618090208P</guid></item></channel></rss>