Any suggestions on how I can double-map this parent-child relationship, where the parent has a normal 1-many relationship (which is working), but then I need a direct 1:1,0 link from the parent to a particular 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 the Parent/Child Mapping (Working)
modelBuilder.Entity(Of Source).HasMany(
Function(S) S.SourceFields
).WithRequired(
Function(SF) SF.Source
).HasForeignKey(
Function(SF) SF.SourceID
)
This is my failed attempt at an additional direct mapping (Not Working):
modelBuilder.Entity(Of Source
).HasOptional(
Function(S) S.InboundMatchKeySourceField
).WithRequired(
Function(SF) SF.Source
)
This yields me the 'MetaDataException':
Schema specified is not valid. Errors: The relationship '_____.Source_InboundMatchKeySourceField' was not loaded because the type '_____.SourceField' is not available.