Export (0) Print
Expand All

ProfileService.Initialize Method (PIA)

Commerce Server 2002

Use this method to establish a connection to the Commerce Server Profiles store and populate the schema cache with all the schemas from the specified catalog.

Definition

[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Profiles
…
Public Sub Initialize(
  sConfigStore As String,
  Optional sCatalog As String
)
[C#]
using Microsoft.CommerceServer.Interop.Profiles;
…
public void Initialize(
  string sConfigStore,
  string sCatalog
);

Parameters

[Visual Basic .NET]
sConfigStore
A String that contains the connection string to the Profiles store.
sCatalog
An optional String that identifies the catalog. If this is specified it must be "Profile Definitions".
[C#]
sConfigStore
A string that contains the connection string to the Profiles store.
sCatalog
A string that identifies the catalog. The value of this parameter must be "Profile Definitions".

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The Errors property stores the collection of errors encountered in the last Profiles resource operation if an exception is thrown. For more information, see ProfileService.Errors.

Remarks

The Initialize method creates the necessary internal parameters and schema cache for profile management. A ProfileService object must connect to only one Profiles store. Multiple instances of the ProfileService object must be created to access multiple stores.

The connection string for the Profiles store may be obtained through the SiteConfigReadOnly object, or through the Commerce Server Manager console from the s_ProfileServiceConnectionString property under the key "Commerce Server Manager\Global Resources\Profiles(ComputerName SiteName)".

The connection string consists of the following mandatory tokens:

  • Data Source and/or Database [mandatory]. This attribute allows applications to specify the name of the underlying instance of SQL Server containing the Profiles database. At least one of these attributes must be specified. If both of these attributes are specified, the value of the Data Source attribute takes precedence.
  • Initial Catalog and/or Server [mandatory]. This attribute allows applications to specify the name of the Profiles database containing profile definitions. At least one of these attributes must be specified. If both of these attributes are specified, the value of the Initial Catalog attribute takes precedence.
  • User ID and/or UID [mandatory]. This attribute allows applications to specify the login name to connect to the Profiles database. At least one of these attributes must be specified. If both of these attributes are specified, the value of the User ID attribute takes precedence.

The following is a sample connection string containing these attributes:

   Data Source=servername;Initial Catalog=dbname;User ID=user

Spaces are not allowed around the delimiting semicolons, and a semicolon is not allowed in the names of any of the tokens.

Additionally, the following optional tokens are also supported by the Profiles resource:

  • Provider [optional]. Allows applications to specify the OLE DB provider to which the Profiles resource connects. This parameter exists for consistency with standard ADO connection strings. The default value and only acceptable value for this attribute is CSOLEDB.
  • Password [optional]. Allows applications to specify the password for the user specified by the User ID or UID attribute. The default value for this attribute is null.
  • PsObjectCacheSize [optional]. Allows applications to specify the size of the Profiles resource object cache. This cache stores ProfileObject objects instantiated by the CreateProfile and GetProfile methods. The default value for this attribute is 32768.
  • PsSchemaCacheSize [optional]. Allows applications to specify the size of the Profiles resource definition (schema) cache. After it is loaded, entries cannot be purged from the cache. The default value for this attribute is 64.
  • PsBackgroundThread [optional]. Allows applications to control the creation of a background thread to periodically clean up entries from the Profiles resource object cache. The acceptable values for this parameter are zero (0) or one (1). Zero turns off the background thread, and one turns it on. By default, the background thread is on.
  • PsObjectAgeoutPeriod [optional]. Allows applications to specify the age-out period for the Profiles resource cache entries. The age-out period is the amount of time an unreferenced object can remain in the cache without being discarded. The default value for this attribute is five minutes.
  • Integrated Security [optional]. Allows applications to connect to the Profile Service using integrated windows authentication. The value for this token should be SSPI. When this token is specified the values for User ID/UID and Password/PWD tokens are ignored.
  • Site Name [optional]. Allows applications to specify the site name under which the Profile Service counters should be logged. If no value is specified the performance counters are logged under Anonymous.
  • Connection_Retry [optional]. Allows the applications to specify the number of retry attempts if the connection to the Profile definition store is lost due to a communication failure. The default value for this attribute is 10.
  • Connection_Retry_Delay [optional]. Allows the applications to specify the delay in seconds between retry attempts if the connection to the Profile definition store is lost due to a communication failure. The default value for this attribute is 30.
  • PublicKey [optional]. This token allows the applications to specify the public key if any of the profiles defined use asymmetric encryption. The value for the token should be a hexadecimal string representation of the Public Key. The value should not be enclosed in quotes.
  • KeyIndex [optional]. This token is mandatory if the PublicKey is specified. Since Public and Privtate keys come in pairs, this token allows the applications to specify which PrivateKey token value corresponds to the PublicKey token.
  • PrivateKey1 [optional]. This token allows the applications to specify the Private key for decryption. The value for this token should be specified if the current key index is 1 and should correspond to the PublicKey. The value for the token should be a hexadecimal string representation of the Private Key. The value should not be enclosed in quotes.
  • PrivateKey2 [optional]. This token allows the applications to specify the Private key for decryption. The value for this token should be specified if the current key index is 1 and should correspond to the PublicKey. The value for the token should be a hexadecimal string representation of the Private Key. The value should not be enclosed in quotes.

Ee796387.note(en-US,CS.20).gif Notes

  • The Initial Catalog in the connection string is the database containing the Profiles store.
  • The sCatalog parameter in the Initialize method is the catalog containing the profile schema definitions, which is "Profile Definitions".
[Visual Basic .NET]

Example

' Connect using an explicit connection string.
' oProfileService is a Commerce ProfileService object

oProfileService.Initialize("Provider=CSOLEDB;Data Source=MyServer;" _
 & "Initial Catalog=Retail_commerce;Integrated Security='SSPI';" _
 & "PsSchemaCacheSize=128;PsObjectAgeoutPeriod=8", "Profile Definitions")

' Connect through the SiteConfigReadOnly object.
' sConn is a String
' oSCRO is an initialized SiteConfigReadOnly object

sConn = oSCRO.Fields("Profiles(ComputerName SiteName").Value _
 .Fields("s_ProfileServiceConnectionString").Value & "SCHCACHE=128"
oProfileService.Initialize(sConn, "Profile Definitions")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Profiles

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsupslib (in mscsupslib.dll)

See Also

ProfileService Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft