I\'m learning DDD and the tutorial I\'m currently following is implemented using NHibernate, but since my lack of experience with it I\'ve decided to go through the course u
Your attempts are not working because owned types can only be configured through their owner entity, and more specifically, through their own builder returned by the OwnsOne
method or provided as an argument of the Action<T>
argument of the OwnsOne
method of the owner entity builder.
So the configuration should be something like this (note the nested OwnsOne
):
modelBuilder.Entity<Customer>(customer =>
{
customer.OwnsOne(e => e.Status, status =>
{
status.Property(e => e.Type).HasColumnName("Status");
status.OwnsOne(e => e.ExpirationDate, expirationDate =>
{
expirationDate.Property(e => e.Date).HasColumnName("StatusExpirationDate");
});
});
});