I'm having a problem with the generated code for DNN where the table has a foreign key relationship to another table for which i'm not generating EntitySpaces code, such as the default DNN tables.
E.g. If one of my tables has a foreign key ModuleId which references the Modules table, the generated code is failing to build because of "DNNModules is not defined errors." Obviously i don't need to build code for the Modules table, so what's the solution here? Remove all the foreign keys?
In the code below DnnModules is underlined as an error.
Code:
#Region "UpToDnnModulesByModuleId - Many To One"
''' <summary>
''' Many to One
''' Foreign Key Name - FK_dnn_otv_Addresses_dnn_Modules
''' </summary>
<XmlIgnore()> _
Public Property UpToDnnModulesByModuleId As DnnModules
Get
If Me._UpToDnnModulesByModuleId Is Nothing _
AndAlso Not ModuleId.Equals(Nothing) _
Me._UpToDnnModulesByModuleId = New DnnModules()
Me._UpToDnnModulesByModuleId.es.Connection.Name = Me.es.Connection.Name
Me.SetPreSave("UpToDnnModulesByModuleId", Me._UpToDnnModulesByModuleId)
Me._UpToDnnModulesByModuleId.Query.Where(Me._UpToDnnModulesByModuleId.Query.ModuleID.Equal(Me.ModuleId))
Me._UpToDnnModulesByModuleId.Query.Load()
End If
Return Me._UpToDnnModulesByModuleId
End Get
Set(ByVal value As DnnModules)
Me.RemovePreSave("UpToDnnModulesByModuleId")
If value Is Nothing Then
Me.ModuleId = Nothing
Me._UpToDnnModulesByModuleId = Nothing
Else
Me.ModuleId = value.ModuleID
Me._UpToDnnModulesByModuleId = value
Me.SetPreSave("UpToDnnModulesByModuleId", Me._UpToDnnModulesByModuleId)
End If
End Set
End Property
#End Region
There is also a problem where I have a table Shipments which includes ShipToAddress and ShipFromAddress both of which are foreign keys referencing the Addresses table. Generating code for the Addresses table creates "DNNShipments" is not defined errors, but there is no reference to the Shipments table in the Addresses table. Isn't this backwards?