1

我有两个与关联实体链接的实体。在代码中,我可以轻松地一次插入一个或所有这些。但是,在前端,我使用 FormViews 来允许用户输入数据。当我插入一个地址时,我如何让它知道同时插入一个设施,除非我在同一个表单视图上拥有设施和地址?

Public Class facility

  <Key()> _
  Public Property facility_id As Integer
  Public Property facility_present_use As String
  Public Property facility_prior_use As String
  Public Property facility_occupied As Boolean
  Public Property facility_size As Double
  Public Property facility_floors As Integer
  Public Property facility_age As Integer
  Public Property facility_single_residence As Boolean
  Public Property facility_number_of_units As Integer      

  Public Overridable Property facility_address As ICollection(Of facility_address) = New HashSet(Of facility_address)

End Class

Public Class address

  <Key()> _
  Public Property address_id As Integer
  Public Property address_name As String
  Public Property address_address_1 As String
  Public Property address_address_2 As String
  Public Property address_city As String
  Public Property address_state As Integer?
  Public Property address_zip As String
  Public Property address_contact_first_name As String
  Public Property address_contact_last_name As String
  Public Property address_phone_area As String
  Public Property address_phone As String

  Public Overridable Property lu_state As lu_state
  Public Overridable Property facility_address As ICollection(Of facility_address) = New HashSet(Of facility_address)

End Class

Public Class facility_address

  <Key()> _
  Public Property facility_address_id As Integer
  Public Property address_type As Integer
  Public Property facility_id As Integer
  Public Property address_id As Integer

  Public Overridable Property lu_address_type As lu_address_type
  Public Overridable Property facility As facility
  Public Overridable Property address As address
End Class
4

0 回答 0