Any suggestions on how I can match this parent-child relationship twice, where the parent has a normal 1-to-many relationship (which works), but then I need a direct link 1: 1.0 from parent to specific child.
Public Class Source
<Key()>
Public Property SourceID As Int32
Public Property SourceFields As List(Of SourceField)
Public Property InboundMatchKeySourceFieldID As Nullable(Of Int32)
Public Property InboundMatchKeySourceField As SourceField
and
Public Class SourceField
<Key()>
Public Property SourceFieldID As Int32
Public Property SourceID As Int32
Public Property Source As Source
This is a parent / child (working) mapping
modelBuilder.Entity(Of Source).HasMany(
Function(S) S.SourceFields
).WithRequired(
Function(SF) SF.Source
).HasForeignKey(
Function(SF) SF.SourceID
)
This is my unsuccessful attempt for additional direct matching (not working):
modelBuilder.Entity(Of Source
).HasOptional(
Function(S) S.InboundMatchKeySourceField
).WithRequired(
Function(SF) SF.Source
)
This gives me a "MetaDataException":
The specified schema is invalid. Errors: relation '_____. Source_InboundMatchKeySourceField 'was not loaded because the type' _____. SourceField 'is not available.
source
share