AssociationAttribute.IsForeignKey Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le membre comme clé étrangère dans une association représentant une relation de base de données.
public:
property bool IsForeignKey { bool get(); void set(bool value); };
public bool IsForeignKey { get; set; }
member this.IsForeignKey : bool with get, set
Public Property IsForeignKey As Boolean
Valeur de propriété
Valeur par défaut = false
.
Exemples
[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
S’applique à
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage (pull requests). Pour plus d’informations, consultez notre guide du contributeur.
Commentaires
https://aka.ms/ContentUserFeedback.
Prochainement : Tout au long de l'année 2024, nous supprimerons progressivement les GitHub Issues en tant que mécanisme de retour d'information pour le contenu et nous les remplacerons par un nouveau système de retour d'information. Pour plus d’informations, voir:Soumettre et afficher des commentaires pour