Partager via


LobSystemInstanceCollection.Create, méthode (String, Boolean) (Microsoft.Office.Server.ApplicationRegistry.Administration)

Creates an LOBSystemInstance object.

Espace de noms : Microsoft.Office.Server.ApplicationRegistry.Administration
Assembly : Microsoft.SharePoint.Portal (dans microsoft.sharepoint.portal.dll)

Syntaxe

'Déclaration
Public Function Create ( _
    name As String, _
    isCached As Boolean _
) As LobSystemInstance
'Utilisation
Dim instance As LobSystemInstanceCollection
Dim name As String
Dim isCached As Boolean
Dim returnValue As LobSystemInstance

returnValue = instance.Create(name, isCached)
public LobSystemInstance Create (
    string name,
    bool isCached
)

Paramètres

  • name
    The name of the LOBSystemInstance.
  • isCached
    True, if cached, false if not.

Valeur de retour

The LOBSystemInstance object.

Exemple

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server.ApplicationRegistry.Administration;
using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.ApplicationRegistry.Infrastructure;
using System.IO;
using System.Xml;

namespace BDCom
{
    class Program
    {
        static void Main(string[] args)
        {
            SetupBDC();
            CreateLobSystemAndInstance();
            Console.Read();
        }
        static void SetupBDC()
        {
            SqlSessionProvider.Instance().SetSharedResourceProviderToUse("EnterYourSSPNameHere");
        }
        static void CreateLobSystemAndInstance()
        {
            LobSystem system = ApplicationRegistry.Instance.LobSystems.Create("AdventureWorksSampleFromCode", true, "Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbSystemUtility", "Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbConnectionManager", "Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbEntityInstance");

            LobSystemInstance sysInstance = system.LobSystemInstances.Create("AdventureWorksSampleFromCode", true);

            sysInstance.Properties.Add("AuthenticationMode", (Int32)Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAuthenticationMode.PassThrough);

            sysInstance.Properties.Add("DatabaseAccessProvider", (Int32)Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAccessProvider.SqlServer);

            sysInstance.Properties.Add("RdbConnection Data Source", "YourAdvWorks2000ServerNameHere");

            sysInstance.Properties.Add("RdbConnection Initial Catalog", "AdventureWorks2000");

            sysInstance.Properties.Add("RdbConnection Integrated Security", "SSPI");

            sysInstance.Properties.Add("RdbConnection Pooling", "false");

            sysInstance.Properties.Add("WildCardCharacter", "%");

            sysInstance.Update();
            Console.WriteLine("Done");

        }
   }
}

Voir aussi

Référence

LobSystemInstanceCollection, classe
Membres LobSystemInstanceCollection
Microsoft.Office.Server.ApplicationRegistry.Administration, espace de noms