public virtual void SetValue(string grainType, GrainReference grainReference, string name, object val) { lock (StateStore) { Log.Info("Setting stored value {0} for {1} to {2}", name, grainReference, val); var keys = MakeGrainStateKeys(grainType, grainReference); var storedState = StateStore.ReadRow(keys); storedState[name] = val; LastId = GetId(grainReference); LastState = storedState; } }
private void SetValue(Type stateType, string grainType, GrainReference grainReference, string name, object val) { lock (StateStore) { this.logger.Info("Setting stored value {0} for {1} to {2}", name, grainReference, val); var keys = MakeGrainStateKeys(grainType, grainReference); var storedDict = StateStore.ReadRow(keys); if (!storedDict.ContainsKey(stateStoreKey)) { storedDict[stateStoreKey] = Activator.CreateInstance(stateType); } var storedState = storedDict[stateStoreKey]; var field = storedState.GetType().GetProperty(name).GetSetMethod(true); field.Invoke(storedState, new[] { val }); LastId = GetId(grainReference); LastState = storedState; } }