title | description | ms.date | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | author | ms.author | manager | ms.subservice | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Add an Entity to a Model |
Add an entity to a model by adding an entity control from the Visual Studio Toolbox onto the Business Data Connectivity (BDC) designer. |
02/02/2017 |
how-to |
|
|
|
John-Hart |
johnhart |
mijacobs |
sharepoint-development |
To create an entity, add an entity control from the Visual Studio Toolbox onto the Business Data Connectivity (BDC) designer.
-
Create a BDC project, or open an existing BDC project. For more information, see Create a business data connectivity model.
-
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. -
On the designer, open the shortcut menu for the entity, choose Add, and then choose Identifier.
A new identifier appears on the entity.
[!NOTE] You can change the name of the entity and the identifier in the Properties window.
-
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.
:::code language="csharp" source="../sharepoint/codesnippet/CSharp/sp_bdc_entity_data_class/bdcmodel1/contact.cs" id="Snippet1":::