示例#1
0
 protected Task On(AppCreated @event, EnvelopeHeaders headers)
 {
     return(Collection.CreateAsync(@event, headers, a =>
     {
         SimpleMapper.Map(@event, a);
     }));
 }
示例#2
0
 void When(AppCreated e)
 {
     AppId       = e.AppId;
     Title       = e.Title;
     Description = e.Description;
     IconClass   = e.IconClass;
     Url         = e.Url;
 }
示例#3
0
 private void Apply(AppCreated @event)
 {
     Id          = @event.AggregateRootId;
     Name        = @event.Name;
     Description = @event.Description;
     Folder      = @event.Folder;
     Status      = AppStatus.Active;
 }
示例#4
0
        public void On(AppCreated @event, EnvelopeHeaders headers)
        {
            App = EntityMapper.Create <JsonAppEntity>(@event, headers, a =>
            {
                SimpleMapper.Map(@event, a);

                a.LanguagesConfig = LanguagesConfig.Build(Language.EN);
            });
        }
示例#5
0
 protected Task On(AppCreated @event, EnvelopeHeaders headers)
 {
     return(ForAppIdAsync(@event.AppId.Id, async collection =>
     {
         await collection.Indexes.CreateOneAsync(Index.Ascending(x => x.SchemaId).Descending(x => x.LastModified));
         await collection.Indexes.CreateOneAsync(Index.Ascending(x => x.ReferencedIds));
         await collection.Indexes.CreateOneAsync(Index.Ascending(x => x.IsPublished));
         await collection.Indexes.CreateOneAsync(Index.Text(x => x.DataText));
     }));
 }
示例#6
0
        protected Task On(AppCreated @event, EnvelopeHeaders headers)
        {
            return(Collection.CreateAsync(@event, headers, a =>
            {
                a.Clients = new Dictionary <string, MongoAppEntityClient>();
                a.Contributors = new Dictionary <string, MongoAppEntityContributor>();
                a.ContributorIds = new List <string>();

                SimpleMapper.Map(@event, a);
            }));
        }
        protected Task On(AppCreated @event, EnvelopeHeaders headers)
        {
            return(Collection.CreateAsync(@event, headers, a =>
            {
                SimpleMapper.Map(@event, a);

                a.Clients = new AppClients();
                a.Contributors = new AppContributors();

                a.LanguagesConfig = LanguagesConfig.Build(Language.EN);
            }));
        }
示例#8
0
 public void Setup()
 {
     _command = new CreateApp
     {
         Id          = Guid.NewGuid(),
         Name        = "Name",
         Description = "Description",
         Folder      = "Folder"
     };
     _validatorMock = new Mock <IValidator <CreateApp> >();
     _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult());
     _app   = App.CreateNew(_command, _validatorMock.Object);
     _event = _app.Events.OfType <AppCreated>().SingleOrDefault();
 }
示例#9
0
        public void Handle(AppCreated @event)
        {
            var repository = new Repository <Application>(this.dbContext);

            var app = new Application()
            {
                AppId       = @event.AppId,
                AppSecret   = @event.AppSecret,
                CreatedDate = @event.CreatedDate,
                CreatedUser = @event.CreatedUser,
                IsActive    = @event.IsActive
            };

            repository.Save(app);
            repository.SaveChanges();
        }
示例#10
0
        void HandleEvent(AppCreated evt)
        {
            const string sql = @"
insert into core_App(AppId, Title, Description, IconClass, Url, Sequence, DateCreated, DateUpdated, DateEnabled, DateDeleted)
    values  (@Id, @Title, @Description, @IconClass, @Url, @Sequence, @DateCreated, @DateUpdated, @DateEnabled, @DateDeleted)
;
";

            DbConnection.Execute(sql, new
            {
                evt.AppId.Id,
                evt.Title,
                evt.Description,
                evt.IconClass,
                evt.Url,
                evt.Sequence,
                evt.DateCreated,
                evt.DateUpdated,
                evt.DateEnabled,
                evt.DateDeleted
            }, DbTransaction);
        }
示例#11
0
 protected void On(AppCreated @event)
 {
     name = @event.Name;
 }
示例#12
0
        protected void On(AppCreated @event)
        {
            Roles = Roles.CreateDefaults(@event.Name);

            SimpleMapper.Map(@event, this);
        }
示例#13
0
 protected void On(AppCreated @event)
 {
     SimpleMapper.Map(@event, this);
 }