public ITransactionalState <TState> Create <TState>(TransactionalStateConfiguration config) where TState : class, new()
        {
            TransactionalState <TState> transactionalState = ActivatorUtilities.CreateInstance <TransactionalState <TState> >(this.context.ActivationServices, config, this.context);

            transactionalState.Participate(context.ObservableLifecycle);
            return(transactionalState);
        }
Esempio n. 2
0
        public TransactionalIndexedState(
            IServiceProvider sp,
            IIndexedStateConfiguration config,
            IGrainActivationContext context,
            ITransactionalStateFactory transactionalStateFactory
            ) : base(sp, config, context)
        {
            var indexingTransactionalStateConfig = new IndexingTransactionalStateConfiguration(config.StateName, config.StorageName);
            var transactionalStateConfig         = new TransactionalStateConfiguration(indexingTransactionalStateConfig);

            this.transactionalState = transactionalStateFactory.Create <IndexedGrainStateWrapper <TGrainState> >(transactionalStateConfig);
        }
Esempio n. 3
0
 public TransactionalState(
     TransactionalStateConfiguration transactionalStateConfiguration,
     IGrainContextAccessor contextAccessor,
     ITransactionDataCopier <TState> copier,
     IGrainRuntime grainRuntime,
     ILogger <TransactionalState <TState> > logger)
 {
     this.config       = transactionalStateConfiguration;
     this.context      = contextAccessor.GrainContext;
     this.copier       = copier;
     this.grainRuntime = grainRuntime;
     this.logger       = logger;
     this.copiers      = new Dictionary <Type, object>();
     this.copiers.Add(typeof(TState), copier);
     this.activationLifetime = new ActivationLifetime(this.context);
 }