provider - Using SQL Server as Orleans storage -


i'm trying use sql server data store orleans.

i have managed solution working using azure local storage emulator, can't work local instance of sql server. i've created database using:

https://github.com/dotnet/orleans/blob/master/src/orleanssqlutils/createorleanstables_sqlserver.sql

and made config file 1 here:

http://dotnet.github.io/orleans/documentation/advanced-concepts/configuring-sql-tables.html

this config file:

<?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> 

i've added following attribute grains:

[storageprovider(providername = "sqlserver")] 

i following error: could not locate state map factory type...

please let me know need add providers or if doing else wrong? need create statemapfactorytype sql provider?

thanks

firstly <systemstore> not storageprovider. node membership oracle. this:

<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> 

now lets put in 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> 

now fun part. setting orleans.sqlutils.storageprovider.sqlstorageprovider

this particular storageprovider based on elasticclient p&p group, uses special sharded database (e.g. shard master database, , shard database(s))

might suggest lower friction provider (insert shameless plug (if works wrote it, if doesnt have no idea did :d ) https://github.com/orleanscontrib/orleans.storageproviders.simplesqlserverstorage

ok, orleans.sqlutils.storageprovider.sqlstorageprovider need few more configuration items:

  • connectionstring
  • mapname
  • statemapfactorytype

<provider type="orleans.sqlutils.storageprovider.sqlstorageprovider" name="guts"  connectionstring = "server=.;initial catalog=guts;integrated security=sspi;" mapname="guts" statemapfactorytype="classname, assemblyname" /> 

you need create statemapfactory implementing orleans.sqlutils.storageprovider.igrainstatemapfactory see https://github.com/dotnet/orleans/blob/v1.1.3/src/orleanssqlutils/storage/provider/igrainstatemapfactory.cs

you can use https://github.com/dotnet/orleans/blob/v1.1.3/src/testerinternal/storagetests/sqladapter/samplegrainstatemapfactory.cs reference

but!! looks release 1.1.3 still has orleans.sqlutils.storageprovider.igrainstatemapfactory marked internal, have compile source or latest github.


Comments