InstanceStoreProvider クラス
すべてのインスタンス ストア プロバイダーの基本クラスを表します。
名前空間: Microsoft.ApplicationServer.StoreProvider
アセンブリ: Microsoft.ApplicationServer.StoreProvider (microsoft.applicationserver.storeprovider.dll)
使用法
構文
'宣言
Public MustInherit Class InstanceStoreProvider
Inherits ProviderBase
public abstract class InstanceStoreProvider : ProviderBase
public ref class InstanceStoreProvider abstract : public ProviderBase
public abstract class InstanceStoreProvider extends ProviderBase
public abstract class InstanceStoreProvider extends ProviderBase
解説
InstanceStoreProvider のサンプル実装を次に示します。
using Microsoft.ApplicationServer.StoreProvider;
using System.Runtime.DurableInstancing;
using System.Activities.DurableInstancing;
//for the sample code provided in the methods
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
namespace MySqlStoreProviderNS
{
public sealed class MySqlWorkflowInstanceStoreProvider : InstanceStoreProvider
{
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 InstanceStore CreateInstanceStore()
{
// the following line creates an instance of the SqlWorkflowInstanceStore class
SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(this.ConnectionString);
return store;
}
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();
}
}
}
}
}
継承の階層
System.Object
System.Configuration.Provider.ProviderBase
Microsoft.ApplicationServer.StoreProvider.InstanceStoreProvider
Microsoft.ApplicationServer.StoreProvider.Sql.SqlWorkflowInstanceStoreProvider
スレッド セーフ
この型のパブリック静的 (Visual Basic では Shared ) メンバーはスレッド セーフです。インスタンスのメンバーはいずれも、スレッド セーフである保証はありません。
プラットフォーム
開発プラットフォーム
Visual Studio 2010 およびそれ以降, .NET Framework 4
対象プラットフォーム
Windows 7; Windows Server 2008 R2; Windows Server 2008 Service Pack 2; Windows Vista Service Pack 2
Change History
関連項目
参照
InstanceStoreProvider メンバー
Microsoft.ApplicationServer.StoreProvider 名前空間