I am trying to seed an user entity in my database. The User
entity has an owend property EmailPermissions
.
When I run the command
In my scenario I wanted the owned-type property to be auto-initialed in the parent class:
public class User
{
EmailPermissions _EmailPermissions;
public EmailPermissions
{
get => _EmailPermissions ??= new EmailPermissions();
set => _EmailPermissions = value;
}
}
When I tried to add seed data I got that nasty exception.
The solution was to pass the User
as anonymous type in its HasData
call.