I created a new required foreign key column for the AbpUsers
table; the problem started when I ran the data seeder. it is throwing the following error:
Cannot insert the value NULL into column 'TimeZoneId', table 'dbo.AbpUsers'; column does not allow nulls. INSERT fails.
That happened because it was trying to insert a null TimeZoneId. After all, it does not know where to get it... The ABP framework manages the user seeder. How can I tell the identity seeder to get that TimeZoneId from the TimeZone table if the identity seeder is managed by the framework?
Extension configurator:
ObjectExtensionManager.Instance.Modules().ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<Guid>(
"TimeZoneId",
property => {
property.UI.Lookup.Url = "/api/app/time-zone";
property.UI.Lookup.DisplayPropertyName = "description";
property.DisplayName = L("::TimeZone");
}
);
});
});
Extension mappings:
ObjectExtensionManager.Instance.MapEfCoreProperty<IdentityUser, Guid?>(
AggregatorConsts.TimeZonePropertyName, (_, propertyBuilder) =>
{
propertyBuilder.IsRequired();
}
});
DbContext:
builder.Entity<IdentityUser>(b =>
{
b.HasOne(typeof(TimeZone))
.WithMany()
.HasForeignKey("TimeZoneId")
.IsRequired();
});
Note, I'm using OpenIddict
auth server.