本文整理匯總了VB.NET中System.Data.Linq.Mapping.AssociationAttribute類的典型用法代碼示例。如果您正苦於以下問題:VB.NET AssociationAttribute類的具體用法?VB.NET AssociationAttribute怎麽用?VB.NET AssociationAttribute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了AssociationAttribute類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: EntityRef
Private _Customer As EntityRef(Of Customer)
<Association(Name:="FK_Orders_Customers", Storage:="_Customer", ThisKey:="CustomerID", IsForeignKey:=True)> _
Public Property Customer() As Customer
Get
Return Me._Customer.Entity
End Get
Set(ByVal value As Customer)
Dim previousValue As Customer = Me._Customer.Entity
If (((previousValue Is value) _
= False) _
OrElse (Me._Customer.HasLoadedOrAssignedValue = False)) Then
Me.SendPropertyChanging()
If ((previousValue Is Nothing) _
= False) Then
Me._Customer.Entity = Nothing
previousValue.Orders.Remove(Me)
End If
Me._Customer.Entity = value
If ((value Is Nothing) _
= False) Then
value.Orders.Add(Me)
Me._CustomerID = value.CustomerID
Else
Me._CustomerID = CType(Nothing, String)
End If
Me.SendPropertyChanged("Customer")
End If
End Set
End Property