Entity.FindSpecific Method (Object, LobSystemInstance)

Gets a single entity instance given its ID.

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

Syntax

'Declaration
Public Function FindSpecific ( _
    identifierValue As Object, _
    lobSystemInstance As LobSystemInstance _
) As IEntityInstance
'Usage
Dim instance As Entity
Dim identifierValue As Object
Dim lobSystemInstance As LobSystemInstance
Dim returnValue As IEntityInstance

returnValue = instance.FindSpecific(identifierValue, _
    lobSystemInstance)
public IEntityInstance FindSpecific(
    Object identifierValue,
    LobSystemInstance lobSystemInstance
)

Parameters

  • identifierValue
    Type: System.Object
    The value of the identifier.

Return Value

Type: Microsoft.Office.Server.ApplicationRegistry.Runtime.IEntityInstance
An entity instance.

Remarks

This form of the API works when there is only one Identifier that is required to uniquely identify an instance of the entity.

Examples

This example shows how to execute a SpecificFinder method on the Product entity in the AdventureWorks2000 sample.

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 ExecuteSpecificFinder
    {
        const string yourSSPName ="EnterYourSSPNameHere";

        static void Main(string[] args)
        {
            SetupBDC();
            FindSpecific();
            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
        static void SetupBDC()
        {
            SqlSessionProvider.Instance().SetSharedResourceProviderToUse(yourSSPName);
        }
        static void FindSpecific()
        {
            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            LobSystemInstance AdvWorksIns = sysInstances["AdventureWorksSampleInstance"];
            Entity prodEntity = AdvWorksIns.GetEntities()["Product"];
            //ProductID = 1
            IEntityInstance IE = prodEntity.FindSpecific(1, AdvWorksIns);
            foreach (Field f in prodEntity.GetSpecificFinderView().Fields)
                Console.Write(IE[f]);
            Console.WriteLine("");
        }
    }
} 

See Also

Reference

Entity Class

Entity Members

FindSpecific Overload

Microsoft.Office.Server.ApplicationRegistry.MetadataModel Namespace