AssociationAttribute.ThisKey Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets members of this entity class to represent the key values on this side of the association.
public:
property System::String ^ ThisKey { System::String ^ get(); void set(System::String ^ value); };
public string ThisKey { get; set; }
member this.ThisKey : string with get, set
Public Property ThisKey As String
Property Value
Default = Id of the containing class.
Examples
[Association(Name="FK_CustomerCustomerDemo", Storage="_CustomerDemographic", ThisKey="CustomerTypeID", IsForeignKey=true)]
public CustomerDemographic CustomerDemographic
{
get
{
return this._CustomerDemographic.Entity;
}
set
{
CustomerDemographic previousValue = this._CustomerDemographic.Entity;
if (((previousValue != value)
|| (this._CustomerDemographic.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._CustomerDemographic.Entity = null;
previousValue.CustomerCustomerDemos.Remove(this);
}
this._CustomerDemographic.Entity = value;
if ((value != null))
{
value.CustomerCustomerDemos.Add(this);
this._CustomerTypeID = value.CustomerTypeID;
}
else
{
this._CustomerTypeID = default(string);
}
this.SendPropertyChanged("CustomerDemographic");
}
}
}
<Association(Name:="FK_CustomerCustomerDemo", Storage:="_CustomerDemographic", ThisKey:="CustomerTypeID", IsForeignKey:=True)> _
Public Property CustomerDemographic() As CustomerDemographic
Get
Return Me._CustomerDemographic.Entity
End Get
Set(ByVal value As CustomerDemographic)
Dim previousValue As CustomerDemographic = Me._CustomerDemographic.Entity
If (((previousValue Is value) _
= False) _
OrElse (Me._CustomerDemographic.HasLoadedOrAssignedValue = False)) Then
Me.SendPropertyChanging()
If ((previousValue Is Nothing) _
= False) Then
Me._CustomerDemographic.Entity = Nothing
previousValue.CustomerCustomerDemos.Remove(Me)
End If
Me._CustomerDemographic.Entity = value
If ((value Is Nothing) _
= False) Then
value.CustomerCustomerDemos.Add(Me)
Me._CustomerTypeID = value.CustomerTypeID
Else
Me._CustomerTypeID = CType(Nothing, String)
End If
Me.SendPropertyChanged("CustomerDemographic")
End If
End Set
End Property
Remarks
For multiple members, use a comma-separated list.
The key is not required to match the primary key or foreign key, but the user-stated cardinality (0-1 for EntityRef<TEntity> or 0-n for EntitySet<TEntity>) is assumed to be true.
Applies to
Surađujte s nama na GitHubu
Izvor za ovaj sadržaj možete pronaći na GitHubu, gdje možete stvarati i pregledavati probleme i zahtjeve za povlačenjem. Dodatne informacije potražite u našem vodiču za suradnike.