-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Milestone
Description
Steps to reproduce
PropertyClassEntity
public class PropertyClassEntity
{
public override PropertyClassEntityTypeEnum Id { get; set; }
}
PropertyEntity.cs
public sealed class PropertyEntity : Entity
{
public PropertyClassEntity PropertyClass { get; set; }
}
PropertyClassEntityTypeEnum
public enum PropertyClassEntityTypeEnum : byte
{
A = 1,
B,
C
}
CommonMapping (works)
builder.Property(t => t.Id).ValueGeneratedOnAdd();
builder.HasKey(t => t.Id);
CommonMapping (does not work)
builder.HasKey(t => t.Id);
builder.Property(t => t.Id).ValueGeneratedOnAdd();
The issue
When trying to save the PropertyEntity it will throw the following error:
Result Message: The property 'Id' on entity type 'PropertyClassEntity' has a temporary value while attempting to change the entity's state to 'Unchanged'. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.
Further technical details
EF Core version: 1.0.0-rc2-final
Operating system: Win10
Visual Studio version: VS 2015