Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: "Sequence contains no elements" exception is thrown by DropCreateDatabaseIfModelChanges initializer [1019]

$
0
0
Using Nightly 6.0.0-alpha3-20404

Repro steps:
Create new console application with inheritance, EdmProperty Model based conventions, and Initializer
comment out ModelBuilder.Conventions.Add line
Run application (populate database)
uncomment ModelBuilder.Conventions.Add line
Run application
"Sequence contains no elements" Exception is thrown

Attached Program.cs contains the model and application logic

model has two classes, one inheriting from the other with a one to many foreign key relationship between the two.

convention:
class ModelBasedConvention : IDbConvention<EdmProperty>
{
public void Apply(EdmProperty property, EdmModel model)
{
property.Name = "_" + property.Name;
}
}
Comments: This is an issue with the ModelDiffer. It occurs when you rename the foreign key column of a self-referencing association. ``` C# class Employee { public int Id { get; set; } // TODO: Uncomment to rename FK column // [Column("Manager_Id")] public int? ManagerId { get; set; } public Employee Manager { get; set; } } ```

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>