public ITransactionalStateStorage <TState> Create <TState>(string stateName, IGrainActivationContext context)
            where TState : class, new()
        {
            var stateRef = new StateReference(context.GrainInstance.GrainReference, stateName);

            return(ActivatorUtilities.CreateInstance <PostgreSqlTransactionalStateStorage2 <TState> >(
                       context.ActivationServices, stateRef, _options, _jsonSettings));
        }
Exemplo n.º 2
0
 public PostgreSqlTransactionalStateStorage(StateReference stateReference,
                                            PostgreSqlTransactionalStateOptions options,
                                            JsonSerializerSettings jsonSettings)
 {
     _stateId      = stateReference.ToString();
     _options      = options;
     _jsonSettings = jsonSettings;
     _jsonSettings.TypeNameHandling     = TypeNameHandling.Auto;
     _jsonSettings.DefaultValueHandling = DefaultValueHandling.Include;
     _jsonSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
 }
Exemplo n.º 3
0
 public PostgreSqlTransactionalStateStorage2(StateReference stateReference,
                                             PostgreSqlTransactionalStateOptions options,
                                             JsonSerializerSettings jsonSettings,
                                             ILogger <PostgreSqlTransactionalStateStorage2 <TState> > logger)
 {
     _stateId      = stateReference.ToString();
     _options      = options;
     _dbExecuter   = new DbExecuter(_options.ConnectionString);
     _jsonSettings = jsonSettings;
     _logger       = logger;
     _jsonSettings.TypeNameHandling     = TypeNameHandling.Auto;
     _jsonSettings.DefaultValueHandling = DefaultValueHandling.Include;
     _jsonSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
 }