Export (0) Print
Expand All

How to: Get Started with Using the Runtime Object Model

SharePoint 2007

The Runtime object model is designed for use by Business Data Catalog clients and applications. The Runtime object model has two major functions.

  • The Runtime object model offers an intuitive, object-oriented interface that abstracts the underlying data sources. It insulates the client from having to learn adapter-specific coding paradigms and allows clients to access all business applications in a single, simplified way. Because of the Runtime object model, calling a method on an SAP application is similar to calling a method on Siebel or executing an SQL query. However, the Business Data Catalog does not perform the actual method execution or back-end plumbing. It merely delegates the client invocation to the appropriate Microsoft ADO.NET provider for databases and Web services proxy for Web services.

  • The Runtime object model follows the Business Data Catalog Metadata Model. It defines all 13 metadata objects and allows you to read the objects from the metadata repository and execute the business logic described in the metadata repository. Because the Runtime object model is cached and fast, clients that just need to query the metadata repository for metadata information should use it.

The Runtime object model is defined in the following namespaces in the Microsoft.SharePoint.Portal.dll:

In this section, we look at how to write simple Microsoft Visual Studio 2005 console applications in Microsoft Visual C# that use the Runtime object model to browse the metadata repository and execute methods on the business applications.

As in the Administration object model, ApplicationRegistry is the top-level object in the Runtime object model. It acts as the entry point to the Business Data Catalog and enables you to read metadata objects and execute methods.

NoteNote:

The Business Data Catalog feature was named Application Registry originally, but is now named Business Data Catalog. This is why you will find the term ApplicationRegistry in the object model. When you see this term, remember that it refers to the Business Data Catalog.

Example

As you might already know, the Business Data Catalog is implemented as a Microsoft Office SharePoint Server 2007 shared service and is shared across a Shared Services Provider. Therefore, before you can use the ApplicationRegistry object, you must reference the Shared Services Provider associated with the Business Data Catalog.

The following code example shows how to set the default Shared Services Provider (SSP) in your local server farm for use with the Business Data Catalog, and display the names of the systems registered in the Business Data Catalog. Specifying the SSP is the first step in setting up a console application to work with the Business Data Catalog.

After you specify the Shared Resource Provider, you can use the ApplicationRegistry object to get the LOBSystemInstance objects registered with the Business Data Catalog, as shown in the following example.

Prerequisites

  • Ensure a Shared Services Provider has already been created.

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

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

        static void Main(string[] args)
        {
            SetupBDC();
            DisplayLOBSystemsinBDC();
            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);
            }
        }
    }
}

See Also

Community Additions

ADD
Show:
© 2015 Microsoft