5

Orleans のデータ ストアとして SQL Server を使用しようとしています。

Azure ローカル ストレージ エミュレーターを使用してソリューションを動作させることができましたが、SQL Server のローカル インスタンスで動作させることができません。以下を使用してデータベースを作成しました。

https://github.com/dotnet/orleans/blob/master/src/OrleansSQLUtils/CreateOrleansTables_SqlServer.sql

私の設定ファイルを次のようにしました:

http://dotnet.github.io/orleans/Documentation/Advanced-Concepts/Configuring-SQL-Tables.html

これは私の設定ファイルです:

<?xml version="1.0" encoding="utf-8"?>
<OrleansConfiguration xmlns="urn:orleans">
  <Globals>
    <StorageProviders>
      <SystemStore SystemStoreType ="SqlServer"
           DeploymentId="OrleansTest"
           DataConnectionString="Data Source=.\SQL2014;Initial Catalog=Orleans;Integrated Security=True;Pooling=False;Max Pool Size=200;Asynchronous Processing=True;MultipleActiveResultSets=True" AdoInvariant="System.Data.SqlClient" />
      <Provider Type="Orleans.SqlUtils.StorageProvider.SqlStorageProvider" Name="SqlServer" />
      <!--<Provider Type="Orleans.Storage.AzureTableStorage" Name="AzureStore" DataConnectionString="UseDevelopmentStorage=true" />-->
    </StorageProviders>
    <SeedNode Address="localhost" Port="11111" />
  </Globals>
  <Defaults>
    <Networking Address="localhost" Port="11111" />
    <ProxyingGateway Address="localhost" Port="30000" />
  </Defaults>
</OrleansConfiguration>

グレインに次の属性を追加しました。

[StorageProvider(ProviderName = "SqlServer")]

次に、次のエラーが表示されます。 Could not locate a state map factory type...

プロバイダーに何を追加する必要があるか、または何か間違っているかどうかを誰かに教えてもらえますか? SQL プロバイダーの StateMapFactoryType と関係のあるものを作成する必要がありますか?

ありがとう

4

1 に答える 1

4

まず、<SystemStore>これは StorageProvider ではありません。そのノードは、Membership Oracle 用です。このような:

<OrleansConfiguration xmlns="urn:orleans">
  <Globals>
    <SystemStore SystemStoreType ="SqlServer"
       DeploymentId="OrleansTest"
       DataConnectionString="Data Source=.\SQL2014;Initial Catalog=Orleans;Integrated Security=True;Pooling=False;Max Pool Size=200;Asynchronous Processing=True;MultipleActiveResultSets=True" AdoInvariant="System.Data.SqlClient" />        
  </Globals>
  <Defaults>
    <Networking Address="" Port="11111" />
    <ProxyingGateway Address="" Port="30000" />
  </Defaults>
</OrleansConfiguration>

StorageProvider を入れましょう

<OrleansConfiguration xmlns="urn:orleans">
  <Globals>

<StorageProviders>
  <Provider Type="Orleans.SqlUtils.StorageProvider.SqlStorageProvider" Name="SqlServer" />
</StorageProviders>


    <SystemStore SystemStoreType ="SqlServer"
       DeploymentId="OrleansTest"
       DataConnectionString="Data Source=.\SQL2014;Initial Catalog=Orleans;Integrated Security=True;Pooling=False;Max Pool Size=200;Asynchronous Processing=True;MultipleActiveResultSets=True" AdoInvariant="System.Data.SqlClient" />        
  </Globals>
  <Defaults>
    <Networking Address="" Port="11111" />
    <ProxyingGateway Address="" Port="30000" />
  </Defaults>
</OrleansConfiguration>

今楽しい部分に。の設定Orleans.SqlUtils.StorageProvider.SqlStorageProvider

この特定のストレージ プロバイダーは、P&P グループの ElasticClient に基づいており、特別なシャード データベース (シャード マスター データベースやシャード データベースなど) を使用します。

この低摩擦プロバイダーを提案するかもしれません(恥知らずなプラグインを挿入します(機能する場合は私が書きましたが、機能しない場合は誰がしたかわからない:D)https://github.com/OrleansContrib/Orleans.StorageProviders.SimpleSQLServerStorage

わかりました、戻ってOrleans.SqlUtils.StorageProvider.SqlStorageProvider 、さらにいくつかの構成項目が必要です。

  • 接続文字列
  • マップ名
  • StateMapFactoryType

<Provider Type="Orleans.SqlUtils.StorageProvider.SqlStorageProvider" Name="guts"  ConnectionString = "Server=.;Initial catalog=guts;Integrated Security=SSPI;" MapName="guts" StateMapFactoryType="ClassName, assemblyname" />

https://github.com/dotnet/orleans/blob/v1.1.3/src/OrleansSQLUtils/Storage/Provider/IGrainStateMapFactory.csOrleans.SqlUtils.StorageProvider.IGrainStateMapFactory を参照 して実装する StateMapFactory を作成する必要があります。

参照用にhttps://github.com/dotnet/orleans/blob/v1.1.3/src/TesterInternal/StorageTests/SQLAdapter/SampleGrainStateMapFactory.csを使用できます

しかし!!リリース 1.1.3 にはまだ内部としてマークされているように見えるOrleans.SqlUtils.StorageProvider.IGrainStateMapFactoryので、ソースからコンパイルするか、github から最新のものを入手する必要があります。

于 2016-04-06T22:18:00.577 に答える