public CosmosDBGrainStorage(string name, CosmosDBStorageOptions options, SerializationManager serializationManager,
                                    Providers.IProviderRuntime providerRuntime, IPartitionKeyProvider partitionKeyProvider,
                                    IOptions <ClusterOptions> clusterOptions, IGrainFactory grainFactory, ITypeResolver typeResolver, ILoggerFactory loggerFactory)
        {
            this._name = name;
            this._partitionKeyProvider = partitionKeyProvider;
            this._loggerFactory        = loggerFactory;
            var loggerName = $"{typeof(CosmosDBGrainStorage).FullName}.{name}";

            this._logger  = loggerFactory.CreateLogger(loggerName);
            this._options = options;
            this._serializationManager    = serializationManager;
            this._grainFactory            = grainFactory;
            this._typeResolver            = typeResolver;
            this._serviceId               = clusterOptions.Value.ServiceId;
            this._grainReferenceConverter = providerRuntime.ServiceProvider.GetRequiredService <IGrainReferenceConverter>();

            this._sprocFiles = new Dictionary <string, string>
            {
                { LOOKUP_INDEX_SPROC, $"{LOOKUP_INDEX_SPROC}.js" }
            };

            if (this._options.JsonSerializerSettings == null)
            {
                this._options.JsonSerializerSettings = OrleansJsonSerializer.UpdateSerializerSettings(OrleansJsonSerializer.GetDefaultSerializerSettings(this._typeResolver, this._grainFactory),
                                                                                                      this._options.UseFullAssemblyNames,
                                                                                                      this._options.IndentJson,
                                                                                                      this._options.TypeNameHandling);
                this._options.JsonSerializerSettings.DefaultValueHandling       = DefaultValueHandling.Include;
                this._options.JsonSerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.None;
            }
        }
Exemplo n.º 2
0
        public CosmosDBGrainStorage(string name, CosmosDBStorageOptions options, SerializationManager serializationManager,
                                    IOptions <ClusterOptions> clusterOptions, IGrainFactory grainFactory, ITypeResolver typeResolver, ILoggerFactory loggerFactory)
        {
            this._name = name;

            this._loggerFactory = loggerFactory;
            var loggerName = $"{typeof(CosmosDBGrainStorage).FullName}.{name}";

            this._logger  = loggerFactory.CreateLogger(loggerName);
            this._options = options;
            this._serializationManager = serializationManager;
            this._grainFactory         = grainFactory;
            this._typeResolver         = typeResolver;
            this._serviceId            = clusterOptions.Value.ServiceId;

            this._sprocFiles = new Dictionary <string, string>
            {
                { WRITE_STATE_SPROC, $"{WRITE_STATE_SPROC}.js" },
                { READ_STATE_SPROC, $"{READ_STATE_SPROC}.js" },
                { CLEAR_STATE_SPROC, $"{CLEAR_STATE_SPROC}.js" }
            };
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="options">The option to be validated.</param>
 /// <param name="name">The option name to be validated.</param>
 public CosmosDBStorageOptionsValidator(CosmosDBStorageOptions options, string name)
 {
     this.options = options;
     this.name    = name;
 }
Exemplo n.º 4
0
 public MultiStateSerializer(CosmosDBStorageOptions options, IHashFunction hasher)
 {
     _options = options ?? throw new NullReferenceException(nameof(options));
     _hasher  = hasher ?? throw new NullReferenceException(nameof(hasher));;
 }