Closed ghost closed 6 years ago
Note for triage: the issue is triggered by a hiding a property in a mapped base class with another property in the derived class when attempt is made to include them both in the model. Simplified repro:
public class Blog
{
public int Id { get; set; }
}
public class ABlog : Blog
{
public new Guid Id { get; set; }
}
public class BloggingContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ABlog>(b =>
{
b.Property(e => ((Blog) e).Id);
b.Property(e => e.Id);
});
}
}
public class Program
{
public static void Main()
{
using (var context = new BloggingContext())
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
}
}
}
As I did before :p
More information on the context can be found here:
I get this:
Here a repo