This documentation is archived and is not being maintained.

How to: Add an Entity to a Model

To create an entity, add an entity control 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, add an Entity control onto 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, open the shortcut menu for the entity, choose Add, and then choose Identifier.

    A new identifier appears on the entity.

    Note Note

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