Open samisq opened 2 years ago
@samisq ValueObjects should use the OwnsOne, OwnsMany, or direct conversion to a literal pattern.
In your case it should be:
modelBuilder.Entity<TestEntity>().OwnsOne(x => x.Sequence, builder =>
{
builder.Property(x => x.Values)
.HasPostgresArrayConversion<IntWrapper, int>(x => x.Value, i => new IntWrapper(i));
});
HasPostgresArrayConversion
cannot map an array that's nested inside a simple value object, because it expects the array property to be accessed directly from the entity.For example, consider the model below:
Previously, we could accomplish this with
HasConversion
, like:In domain-driven design, it's common to encapsulate primitives into value objects to create rich domain model that handles domain validation, and other business rules. Is there a recommended way to address this in v6?