ProfileService.Initialize

Ee825857.c++_on(en-US,CS.10).gifEe825857.vb_off(en-US,CS.10).gif

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

Sub Initialize(sConfigStore As String,OptionalsCatalog As String)

Parameters

sConfigStore

[in] A String that contains the connection string to the Profiles store.

sCatalog

[in, optional] A String that identifies the catalog. If this is specified it must be "Profile Definitions".

Return Values

None.

Error Values

The Errors property stores the collection of errors encountered in the last Profiles resource operation. 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 is comprised of the following mandatory tokens:

  • Data Source and/or Database [mandatory]. This attribute allows applications to specify the name of the underlying 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 semi-colon, and a semi-colon 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. Once 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, 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.

Ee825857.note(en-US,CS.10).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".

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

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

oProfileService.Initialize "Provider=CSOLEDB;Data Source=MyServer;" _
 & "Initial Catalog=Retail_commerce;User ID=user;Password=*****;" _
 & "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"

See Also

ProfileService Object


All rights reserved.