コード例 #1
0
        public static void Main(string[] args)
        {
            //Create actor system
            var system = ActorSystem.Create("useraccount-example");


            //Build create user account aggregate command
            var aggregateId = UserAccountId.New;
            var createUserAccountCommand = new CreateUserAccountCommand(aggregateId, "foo bar");

            //Send command, this is equivalent to command.publish() in other cqrs frameworks
            //system.PublishCommandAsync(createUserAccountCommand);

            var changeNameCommand = new UserAccountChangeNameCommand(aggregateId, "foo bar baz");

            //system.PublishCommandAsync(changeNameCommand);

            //block end of program
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: mallickhruday/Akkatecture
        public static void Main(string[] args)
        {
            //Create actor system
            var system = ActorSystem.Create("useraccount-example");

            //Create supervising aggregate manager for UserAccount aggregate root actors
            var aggregateManager = system.ActorOf(Props.Create(() => new UserAccountAggregateManager()));

            //Build create user account aggregate command
            var aggregateId = UserAccountId.New;
            var createUserAccountCommand = new CreateUserAccountCommand(aggregateId, "foo bar");

            //Send command, this is equivalent to command.publish() in other cqrs frameworks
            aggregateManager.Tell(createUserAccountCommand);

            var changeNameCommand = new UserAccountChangeNameCommand(aggregateId, "foo bar baz");

            aggregateManager.Tell(changeNameCommand);

            //block end of program
            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: lulzzz/Entropy
        public static async Task Main(string[] args)
        {
            //var upcaster = new UserAccountAggregateEventUpcaster();

            //var oldevt = new CommittedEvent<UserAccountAggregate,UserAccountId,UserAccountNameChangedEvent>(UserAccountId.New,new UserAccountNameChangedEvent("test"),null);
            //var
            //var evt1 = upcaster.FromJournal(oldevt, String.Empty);
            //Console.WriteLine("Ok");
            //var evt = upcaster.Upcast(oldevt);
            //Console.WriteLine(evt);

            //Create actor system
            var system = ActorSystem.Create("useraccount-example", Config.Postgres);

            //Create supervising aggregate manager for UserAccount aggregate root actors
            var aggregateManager = system.ActorOf(Props.Create(() => new UserAccountAggregateManager()));

            //Build create user account aggregate command
            //var aggregateId = UserAccountId.New;
            //var createUserAccountCommand = new CreateUserAccountCommand(aggregateId, "foo bar");

            //Send command, this is equivalent to command.publish() in other cqrs frameworks
            //aggregateManager.Tell(createUserAccountCommand);
            var aggregateId = UserAccountId.With("useraccount-a40e3a87-6ebf-4900-884d-7c17477ea20b");

            while (true)
            {
                var newName           = GetRandomString();
                var changeNameCommand = new UserAccountChangeNameCommand(aggregateId, newName);
                aggregateManager.Tell(changeNameCommand);
                await Task.Delay(1000);
            }

            //block end of program
            Console.WriteLine("done");
            Console.ReadLine();
        }
コード例 #4
0
 public bool Execute(UserAccountChangeNameCommand command)
 {
     ChangeName(command.Name);
     return(true);
 }
コード例 #5
0
 public IExecutionResult Execute(UserAccountChangeNameCommand command)
 {
     ChangeName(command.Name);
     return(ExecutionResult.Success());
 }