Entity Class

NOTE: This API is now obsolete.

Represents an entity such as Customer or Product, in a line-of-business (LOB) application.

Inheritance Hierarchy

System.Object
  Microsoft.Office.Server.ApplicationRegistry.MetadataModel.MetadataObject
    Microsoft.Office.Server.ApplicationRegistry.MetadataModel.AccessControlledMetadataObject
      Microsoft.Office.Server.ApplicationRegistry.MetadataModel.DataClass
        Microsoft.Office.Server.ApplicationRegistry.MetadataModel.Entity

Namespace:  Microsoft.Office.Server.ApplicationRegistry.MetadataModel
Assembly:  Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)

Syntax

'Declaration
<ObsoleteAttribute("O12 Application Registry API is deprecated. Please use BusinessData.",  _
    False)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class Entity _
    Inherits DataClass
'Usage
Dim instance As Entity
[ObsoleteAttribute("O12 Application Registry API is deprecated. Please use BusinessData.", 
    false)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class Entity : DataClass

Remarks

In the Business Data Catalog, an entity belongs to a single LOB system. As with all the metadata objects, it derives from the MetadataObject base class and must have a unique name.

Entities contain identifiers, methods, and actions. Entities can also have other related entities associated with them. For example, Customers and Order entities in the AdventureWorks system have an association because they share a relationship: customers make orders. This relationship is implemented as an association in the metadata.

The business objects themselves, for example, customer #88697 and order #1000 in the LOB application are referred to as entity instances. If your entity maps to a database table, you can think of an entity instance as a row.

Client Impact

After you define an entity, you can pick the entity from the Entity Picker, display entity instances in the Business Data Web Parts and lists, and search using Enterprise Search. You must also define the following for entities: identifiers and Finder and SpecificFinder method instances. You may additionally define instance and static GenericInvokers and ViewAccessors.

  • Identifiers   An identifier enables the Business Data Catalog to uniquely identify an entity instance. If you define an entity without an identifier, then that entity cannot have actions on it, cannot be searched or indexed, and cannot be used in any of the Business Data features except the Related List Web Part. However, it is sometimes still useful to define an Entity without Identifiers - if all you want to do is display a list of some or all of them (a good example is 'CostCenters')

  • Finder and SpecificFinder methods   Finder methods enable you to use your entity in a Business Data List Web Part. If you do not define Finder methods, your entity cannot be used in these Web Parts. SpecificFinder methods enable additional functionality such as the ability to have actions, to be searched and indexed, and to be used in Business Data features. If you do not define SpecificFinder methods for an entity, it cannot have actions on it, cannot be searched or indexed, and cannot be used in any of the Business Data features except the Related List Web Part.

  • GenericInvokers. Generic invokers allow you to execute arbitrary logic in a back end system. However, the client must supply the full complex arguments for the invocation.

  • ViewAccessors. Every instance of an entity is said to be a particular 'view' of the Entity. A View is defined by the set of fields on the EntityInstance. All Views share the identifier fields. ViewAccessors allow changing the current view of the EntityInstance to another view.

Schema

Child

Type

Occurs

Default

Limits / Accepted Values

Description

EstimatedInstanceCount

Attribute (bdc:InstanceCount)

0..1

10000

Min.: 0

Estimated number of instances of this entity. Business Data Catalog clients can alter how they display lists of instances based on EstimatedInstanceCount.

Identifiers

Element

1..1

Min. identifiers per entity: 0

Max. identifiers per entity: 20

Container element for Identifier.

Methods

Element

Max. methods per entity: 50

Container element for Method.

Actions

Element

No max. actions per entity enforced

Container Element for Action.

Properties

Following are the properties that the Entity object accepts for both database and Web service systems.

Property

Type

Required

Default Value

Limits/Accepted Values

Comments

Title

System.String

No

None

Name of the T:Microsoft.Office.Server.ApplicationRegistry.MetadataModel.TypeDescriptor instance that represents the display value (title) of an Entity object. This value is the default title of business data search results and the default display value in the business data column.

__BdcTitle

System.String

No

None

This is deprecated.

__BdcLastModifiedTimestamp

System.String

No

None

Name of the TypeDescriptor instance in the return value of the IDEnumerator method that represents the last modified date of an instance.

Use this property to enable incremental search crawls.

Audit

System.Boolean

No

true

true

false

If true, an entry is written to the Shared Resource Provider's audit log each time one of this entity’s methods is executed.

DefaultAction

Name of the Action that is used as the hyperlink in business data search results, business data columns, and elsewhere. This is an auto created property.

Examples

This example shows how to browse the metadata repository and get an LobSystem object and an Entity object.

Prerequisites

  • Ensure a Shared Service Provider is already created.

  • Replace the constant value EnterYourSSPNameHere in the code with the name of your Shared Resource Provider.

  • Make sure the LobSystem object and entity names referenced in the example exist in the Business Data Catalog. Use valid names.

Project References

Add the following Project References in your console application code project before running this sample:

  • Microsoft.SharePoint

  • Microsoft.SharePoint.Portal

  • Microsoft.Office.Server

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Microsoft.Office.Server.ApplicationRegistry.MetadataModel;
using Microsoft.Office.Server.ApplicationRegistry.Runtime;
using Microsoft.Office.Server.ApplicationRegistry.SystemSpecific;
using Microsoft.Office.Server.ApplicationRegistry.Infrastructure;
using WSSAdmin = Microsoft.SharePoint.Administration;
using OSSAdmin = Microsoft.Office.Server.Administration;

namespace Microsoft.SDK.SharePointServer.Samples
{
    class GetSystemAndEntity
    {
        const string yourSSPName = "EnterYourSSPNameHere";

        static void Main(string[] args)
        {
            SetupBDC();
            DisplayLOBSystemsinBDC();
            GetLOBSystem();
            GetEntity();
            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
        static void SetupBDC()
        {
            SqlSessionProvider.Instance().SetSharedResourceProviderToUse(yourSSPName);
        }
        static void DisplayLOBSystemsinBDC()
        {
            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            Console.WriteLine("Listing system instances...");
            foreach (String name in sysInstances.Keys)
            {
                Console.WriteLine(name);
            }
        }
        static void GetLOBSystem()
        {
            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            LobSystemInstance AdvWorksIns = sysInstances["AdventureWorksSampleInstance"];
            Console.WriteLine("Getting a system instance and displaying its ID...");
            LobSystem AdvWorksSys = AdvWorksIns.GetLobSystem();
            Console.WriteLine(AdvWorksSys.Name.ToString());
            Console.WriteLine("ID: "+AdvWorksSys.Id.ToString());
        }

        static void GetEntity()
        {
            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            LobSystemInstance AdvWorksIns = sysInstances["AdventureWorksSampleInstance"];
            Console.WriteLine("Getting an entity object and displaying its ID...");
            Entity prodEntity = AdvWorksIns.GetEntities()["Product"];
            Console.WriteLine(prodEntity.Name.ToString());
            Console.WriteLine("ID: "+prodEntity.Id.ToString());
        }
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Entity Members

Microsoft.Office.Server.ApplicationRegistry.MetadataModel Namespace