This documentation is archived and is not being maintained.

How to: Add an Entity to a Model

To create an entity, drag an entity from the Visual Studio Toolbox onto the Business Data Connectivity (BDC) designer.

To add an entity to the model

  1. Create a BDC project, or open an existing BDC project. For more information, see Creating a Business Data Connectivity Model.

  2. In the Toolbox, from the BusinessDataCatalog group, drag an Entity to the designer.

    The new entity appears on the designer. Visual Studio adds an <Entity> element to the XML of the BDC model file in your project. For more information about the attributes of an Entity element, see Entity.

  3. On the designer, right-click the entity, click Add, and then click Identifier.

    A new identifier appears on the entity.


    You can change the name of the entity and the identifier in the Properties window.

  4. Define the fields of the entity in a class. You can either add a new class to the project or use an existing class created by using other tools such as the Object Relational Designer (O/R Designer). The following example shows an entity class named Contact.

        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; }