Procedura: aggiungere un'entità al modello
Per creare un'entità, aggiungere un controllo di entità da Visual Studio della casella degli strumenti nella finestra di progettazione di connettività dei dati di Business (BDC).
Per aggiungere un'entità al modello
Creare un progetto di integrazione applicativa dei dati o aprirne uno esistente.Per ulteriori informazioni, vedere Creazione di un modello di integrazione applicativa dei dati.
Nel della casella degli strumenti, dal BusinessDataCatalog gruppo, aggiungere un entità controllo nella finestra di progettazione.
La nuova entità verrà visualizzata nella finestra di progettazione.In Visual Studio viene aggiunto un elemento <Entity> all'XML del file modello di integrazione applicativa dei dati nel progetto.Per ulteriori informazioni sugli attributi di un elemento Entity, vedere Entity (la pagina potrebbe essere in inglese).
Nella finestra di progettazione, aprire il menu di scelta rapida per l'entità, scegliere Aggiungi, quindi scegliete identificatore.
Il nuovo identificatore verrà visualizzato nell'entità.
[!NOTA]
È possibile modificare il nome dell'entità e l'identificatore nella finestra Proprietà.
Definire i campi dell'entità in una classe,È possibile aggiungere una nuova classe al progetto o utilizzare una classe esistente creata tramite altri strumenti, ad esempio Progettazione relazionale oggetti.Nell'esempio seguente viene illustrata una classe di entità denominata Contact.
Partial Public Class Contact Private _ContactID As Integer Public Property ContactID() As Integer Get Return _ContactID End Get Set(ByVal value As Integer) _ContactID = value End Set End Property Private _FirstName As String Public Property FirstName() As String Get Return _FirstName End Get Set(ByVal value As String) _FirstName = value End Set End Property Private _LastName As String Public Property LastName() As String Get Return _LastName End Get Set(ByVal value As String) _LastName = value End Set End Property Private _EmailAddress As String Public Property EmailAddress() As String Get Return _EmailAddress End Get Set(ByVal value As String) _EmailAddress = value End Set End Property Private _Phone As String Public Property Phone() As String Get Return _Phone End Get Set(ByVal value As String) _Phone = value End Set End Property Private _EmailPromotion As Integer Public Property EmailPromotion() As Integer Get Return _EmailPromotion End Get Set(ByVal value As Integer) _EmailPromotion = value End Set End Property Private _NameStyle As Boolean Public Property NameStyle() As Boolean Get Return _NameStyle End Get Set(ByVal value As Boolean) _NameStyle = value End Set End Property Private _PasswordHash As String Public Property PasswordHash() As String Get Return _PasswordHash End Get Set(ByVal value As String) _PasswordHash = value End Set End Property Private _PasswordSalt As String Public Property PasswordSalt() As String Get Return _PasswordSalt End Get Set(ByVal value As String) _PasswordSalt = value End Set End Property End Class
public partial class Contact { public int ContactID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string EmailAddress { get; set; } public string Phone { get; set; } public int EmailPromotion { get; set; } public bool NameStyle { get; set; } public string PasswordHash { get; set; } public string PasswordSalt { get; set; } }
Vedere anche
Attività
Procedura: aggiungere un metodo Creator
Procedura: aggiungere un metodo Deleter
Procedura: aggiungere un metodo Updater