コード例 #1
0
        static public async Task RunAsync()
        {
            using (var container = new Container())
            {
                var mediator = BuildMediator(container);

                IDomainEventManager manager = new DomainEventManager(mediator);
                using (var s1 = manager.Scope())
                {
                    await s1.AddAsync(new EventOne("Ross"));

                    await s1.AddAsync(new EventOne("Tammy"));

                    using (var s2 = manager.Scope())
                    {
                        using (var s3 = manager.Scope())
                        {
                            await s3.AddAsync(new EventThree("Ross"));

                            await s3.AddAsync(new EventThree("Tammy"));

                            await s3.BroadcastAsync();
                        }

                        await s2.AddAsync(new EventTwo("Ross"));

                        await s2.AddAsync(new EventTwo("Tammy"));

                        await s2.BroadcastAsync();
                    }

                    await s1.BroadcastAsync();
                }
            }
        }