InstanceControlProvider Class
Represents the base class for all instance control providers
Namespace: Microsoft.ApplicationServer.StoreManagement.Control
Assembly: Microsoft.ApplicationServer.StoreManagement (in microsoft.applicationserver.storemanagement.dll)
Usage
'Usage
Dim instance As InstanceControlProvider
Syntax
'Declaration
Public MustInherit Class InstanceControlProvider
Inherits ProviderBase
public abstract class InstanceControlProvider : ProviderBase
public ref class InstanceControlProvider abstract : public ProviderBase
public abstract class InstanceControlProvider extends ProviderBase
public abstract class InstanceControlProvider extends ProviderBase
Remarks
The following code shows you a sample implementation of this class.
public class MySqlInstanceControlProvider : InstanceControlProvider
{
string ConnectionString { get; set; }
public override void Initialize(string name, NameValueCollection config)
{
this.ConnectionString = config["connectionString"];
// Initialize the base class
base.Initialize(name, config);
}
public override InstanceControl CreateInstanceControl()
{
SqlConnectionStringBuilder connectionStringBuilder = new SqlConnectionStringBuilder(this.ConnectionString);
connectionStringBuilder.AsynchronousProcessing = true;
return new MySqlInstanceControl(connectionStringBuilder.ConnectionString);
}
string UniqueStoreIdentifier { get; set; }
public override string UniqueProviderIdentifier()
{
this.UniqueStoreIdentifier = GetUniqueStoreIdentifier(this.ConnectionString);
return this.UniqueStoreIdentifier;
}
private string GetUniqueStoreIdentifier(string connectionString)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand command = new SqlCommand())
{
command.CommandType = System.Data.CommandType.Text;
command.CommandText = "SELECT TOP (1) [StoreIdentifier] FROM [Microsoft.ApplicationServer.DurableInstancing].[StoreVersion]";
command.Connection = connection;
command.Connection.Open();
Guid identifier = (Guid)command.ExecuteScalar();
return identifier.ToString();
}
}
}
}
Inheritance Hierarchy
System.Object
System.Configuration.Provider.ProviderBase
Microsoft.ApplicationServer.StoreManagement.Control.InstanceControlProvider
Microsoft.ApplicationServer.StoreManagement.Sql.Control.SqlInstanceControlProvider
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
Visual Studio 2010 and later, .NET Framework 4
Target Platforms
Windows 7; Windows Server 2008 R2; Windows Server 2008 Service Pack 2; Windows Vista Service Pack 2
Change History
See Also
Reference
InstanceControlProvider Members
Microsoft.ApplicationServer.StoreManagement.Control Namespace
ff425059(v=azure.10).md 2011-08-26