InstanceQueryProvider Class
Represents the base class for all instance query providers.
Namespace: Microsoft.ApplicationServer.StoreManagement.Query
Assembly: Microsoft.ApplicationServer.StoreManagement (in microsoft.applicationserver.storemanagement.dll)
Usage
'Usage
Dim instance As InstanceQueryProvider
Syntax
'Declaration
Public MustInherit Class InstanceQueryProvider
Inherits ProviderBase
public abstract class InstanceQueryProvider : ProviderBase
public ref class InstanceQueryProvider abstract : public ProviderBase
public abstract class InstanceQueryProvider extends ProviderBase
public abstract class InstanceQueryProvider extends ProviderBase
Remarks
The following code shows you sample implementation of this class.
public sealed class MySqlInstanceQueryProvider : InstanceQueryProvider
{
string storeName;
string ConnectionString { get; set; }
public override void Initialize(string name, NameValueCollection config)
{
this.storeName = name;
this.ConnectionString= config["connectionString"];
// Initialize the base class
base.Initialize(name, config);
}
public override InstanceQuery CreateInstanceQuery()
{
SqlConnectionStringBuilder connectionStringBuilder = new SqlConnectionStringBuilder(this.ConnectionString);
connectionStringBuilder.AsynchronousProcessing = true;
return new MySqlInstanceQuery(this.storeName, 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 = 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.Query.InstanceQueryProvider
Microsoft.ApplicationServer.StoreManagement.Sql.Query.SqlInstanceQueryProvider
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
InstanceQueryProvider Members
Microsoft.ApplicationServer.StoreManagement.Query Namespace
ff425134(v=azure.10).md 2011-08-26