Share via


Entity.FindFiltered Method

NOTE: This API is now obsolete.

Gets a filtered set of entity instances from the business application.

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)> _
Public Function FindFiltered ( _
    filterCollection As FilterCollection, _
    lobSystemInstance As LobSystemInstance _
) As IEntityInstanceEnumerator
'Usage
Dim instance As Entity
Dim filterCollection As FilterCollection
Dim lobSystemInstance As LobSystemInstance
Dim returnValue As IEntityInstanceEnumerator

returnValue = instance.FindFiltered(filterCollection, _
    lobSystemInstance)
[ObsoleteAttribute("O12 Application Registry API is deprecated. Please use BusinessData.", 
    false)]
public IEntityInstanceEnumerator FindFiltered(
    FilterCollection filterCollection,
    LobSystemInstance lobSystemInstance
)

Parameters

  • filterCollection
    Type: Microsoft.Office.Server.ApplicationRegistry.Runtime.FilterCollection

    The FilterCollection object. It must contain the Filters returned by calling the .GetFilters() method on the Finder MethodInstance or by calling .GetFinderFilters on the Entity itself. Each filter returned may have its value set before being used here to return a filtered set of Instances.

Return Value

Type: Microsoft.Office.Server.ApplicationRegistry.Runtime.IEntityInstanceEnumerator
An entity instance collection enumerator.

Examples

This example shows how to execute a Finder 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 ExecuteFinder
    {
        const string yourSSPName ="EnterYourSSPNameHere";

        static void Main(string[] args)
        {
            SetupBDC();
            FindAll();
            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
        static void SetupBDC()
        {
            SqlSessionProvider.Instance().SetSharedResourceProviderToUse(yourSSPName);
        }

        static void FindAll()
        {
            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            LobSystemInstance AdvWorksIns = sysInstances["AdventureWorksSampleInstance"];
            Entity prodEntity = AdvWorksIns.GetEntities()["Product"];
            FilterCollection fc = prodEntity.GetFinderFilters();
            IEntityInstanceEnumerator prodEntityInstanceEnumerator = prodEntity.FindFiltered(fc, AdvWorksIns);
            while (prodEntityInstanceEnumerator.MoveNext())
            {
                IEntityInstance IE = prodEntityInstanceEnumerator.Current;
                foreach (Field f in prodEntity.GetFinderView().Fields)
                    Console.Write(IE[f]);
                Console.WriteLine("");
            }
        }
       
    }
}

See Also

Reference

Entity Class

Entity Members

Microsoft.Office.Server.ApplicationRegistry.MetadataModel Namespace