I am fresh in DDD, and i faced with next issue. I have value object
public record Operation(string Name, string Value);
and two aggregate roots which have this operation in one context
public record Doctor(string Name, Operation Operation);
public record Application (string Name, Operation Operation);
I mapped it
doctorBuilder
.OwnsOne(x => x.Operation, operationBuilder =>
{
.....
});
application Builder
.OwnsOne(x => x.Operation, operationBuilder =>
{
.....
});
And get this error Cannot use table 'customer.Operations' for entity type 'Doctor' since it is being used for entity type 'Application' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Application' on the primary key properties and pointing to the primary key on another entity type mapped to 'customer.Operations'.
How i can map it? Indicate the relationship as one to one does not fit.