A KeyValue SQLServer implementation of the Orleans Storage Provider model. Uses an EF code-first table to store grain keys with binary and/or json serialized data
Install-Package Orleans.StorageProviders.SimpleSQLServerStorage
Decorate your grain with the StorageProvider attribute e.g.
[StorageProvider(ProviderName = "PubSubStore")]
in your OrleansConfiguration.xml configure the provider like this:
<StorageProviders>
<Provider Type="Orleans.StorageProviders.SimpleSQLServerStorage.SimpleSQLServerStorage" Name="PubSubStore"
ConnectionString="Data Source=(LocalDB)\v11.0; Integrated Security=True;"
UseJsonFormat="false" />
<Provider Type="Orleans.StorageProviders.SimpleSQLServerStorage.SimpleSQLServerStorage" Name="SomeOtherGrainStorage"
ConnectionString="Data Source=(LocalDB)\v11.0; Integrated Security=True;"
UseJsonFormat="both" />
</StorageProviders>
If using SQLServer proper, create an empty database and make sure the connecting user has the following permissions
[db_datareader]
[db_datawriter]
[db_ddladmin]
The following attributes can be used on the <Provider/>
tag to configure the provider:
- UseJsonFormat="true/false/both" (optional) Defaults to
false
, if set tofalse
the Orleans binary serializer is used. If set totrue
json data is serialized. if set toboth
then both json and binary data is produced and persisted, but the binary data is used for deserialization(meant for debugging purposes). - ConnectionString="..." (required) the connection string to your SQLServer database (i.e.
any standard SQL Server connection string
)