示例#1
0
        public PropertyCommandTests()
        {
            this.teclyn            = new TeclynApi(new TeclynTestConfiguration());
            this.repositoryService = teclyn.Get <RepositoryService>();
            this.commandService    = teclyn.Get <CommandService>();

            this.repositoryService.Register(typeof(DummyAggregate), typeof(DummyAggregate), typeof(DummyAggregate).Name, null, null);

            this.aggregate = new DummyAggregate
            {
                Value = "value",
                Id    = aggregateId,
            };

            var repository = this.teclyn.Get <IRepository <DummyAggregate> >();

            repository.Create(aggregate);
        }
示例#2
0
        protected async void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var configuration = new TeclynWebConfiguration();
            //configuration.UseStructureMap(StructuremapMvc.Container);
            //configuration.UseMongodbDatabase("TeclynSampleMVC");
            var teclyn       = new TeclynApi(configuration);
            var eventService = teclyn.Get <IEventService>();

            configuration.DropDatabase();

            await eventService.Raise(new TodoListCreatedEvent
            {
                AggregateId = "list-1",
                Name        = "First List",
            });

            await eventService.Raise(new TodoListCreatedEvent
            {
                AggregateId = "list-2",
                Name        = "Second List",
            });

            await eventService.Raise(new TodoListCreatedEvent
            {
                AggregateId = "list-3",
                Name        = "Third List",
            });

            await eventService.Raise(new TodoListCreatedEvent
            {
                AggregateId = "list-4",
                Name        = "Fourth List",
            });

            await eventService.Raise(new TodoCreatedEvent
            {
                AggregateId  = "todo-10",
                TodoListName = "First List",
                TodoListId   = "list-1",
                Text         = "Test"
            });
        }
示例#3
0
 public static async Task <TAggregate> GetAggregate <TAggregate>(this IEvent <TAggregate> @event, TeclynApi teclyn) where TAggregate : class, IAggregate
 {
     return(await teclyn.Get <IRepository <TAggregate> >().GetById(@event.AggregateId));
 }
示例#4
0
 public void Initialize(TeclynApi teclyn)
 {
     teclyn.Get <CommandPropertyRendererFactory>().RegisterRenderer(new TinyMceRenderer());
 }
示例#5
0
 public CommandServiceTests()
 {
     this.teclyn         = new TeclynApi(new TeclynTestConfiguration());
     this.commandService = teclyn.Get <CommandService>();
 }