Beispiel #1
0
        private async Task RecoverStateAsync(IContext ctx)
        {
            ActorId = ctx.Self.Id;
            var state = await AggregateStore.Load <TState>(ctx.Self.Id);

            State = state.Root as TState;
        }
        public CommandStatus Handle(ChangeUsersNameCommand message)
        {
            var user = _userStore.Load("Users", message.UserID, UserAggregate.Blank);

            user.ChangeName(message.NewName);

            _userStore.Save("Users", user);

            return(CommandStatus.Accepted);
        }
        private Permission Clone(Permission permission)
        {
            var store = new AggregateStore<Guid>(new InMemoryEventStore());
            store.Save("test", permission);

            return store.Load("test", permission.ID, () => Permission.Blank());
        }