Degot / Orleans.StorageProviders.SimpleSQLServerStorage

Ultra low friction Orleans Storage Provider using SQLServer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Orleans.StorageProviders.SimpleSQLServerStorage

Build status

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

Usage

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="basic"
                ConnectionString="Data Source=(LocalDB)\v11.0; Integrated Security=True;"
                UseJsonFormat="both" />
    </StorageProviders>

Setup

If using SQLServer proper, create an empty database and make sure the connecting user has the following permissions

[db_datareader]
[db_datawriter]
[db_ddladmin]

Configuration

The following attributes can be used on the <Provider/> tag to configure the provider:

  • UseJsonFormat="true/false/both" (optional) Defaults to false, if set to false the Orleans binary serializer is used (this is recommended, as the JSON serializer is unable to serialize certain types). if set to true json data is serialized. if set to both 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)

About

Ultra low friction Orleans Storage Provider using SQLServer

License:MIT License


Languages

Language:C# 100.0%