示例#1
0
        public SchemaDomainObject Delete(DeleteSchema command)
        {
            VerifyCreatedAndNotDeleted();

            RaiseEvent(SimpleMapper.Map(command, new SchemaDeleted()));

            return(this);
        }
        protected Task On(DeleteSchema command, CommandContext context)
        {
            return(handler.UpdateSyncedAsync <SchemaDomainObject>(context, s =>
            {
                GuardSchema.CanDelete(s.Snapshot.SchemaDef, command);

                s.Delete(command);
            }));
        }
示例#3
0
        private async Task DeleteSchemaAsync(DeleteSchema commmand)
        {
            var schema = await GetSchemaInternalAsync(commmand.AppId.Id, commmand.SchemaId.Id);

            if (IsFound(schema, true))
            {
                await Index(schema.AppId.Id).RemoveAsync(schema.Id);
            }
        }
示例#4
0
        private async Task DeleteSchemaAsync(DeleteSchema commmand)
        {
            var schemaId = commmand.SchemaId;

            var schema = await grainFactory.GetGrain <ISchemaGrain>(schemaId).GetStateAsync();

            if (IsFound(schema.Value, true))
            {
                await Index(schema.Value.AppId.Id).RemoveAsync(schemaId);
            }
        }
示例#5
0
        public async Task Delete_should_create_events_and_update_state()
        {
            var command = new DeleteSchema();

            await ExecuteCreateAsync();

            var result = await sut.ExecuteAsync(CreateCommand(command));

            result.ShouldBeEquivalent(new EntitySavedResult(1));

            Assert.True(sut.Snapshot.IsDeleted);

            LastEvents
            .ShouldHaveSameEvents(
                CreateEvent(new SchemaDeleted())
                );
        }
示例#6
0
        public async Task Should_remove_schema_from_index_on_delete_when_existed_before()
        {
            var schema = SetupSchema();

            var command = new DeleteSchema {
                SchemaId = schemaId, AppId = appId
            };

            var context =
                new CommandContext(command, commandBus)
                .Complete();

            await sut.HandleAsync(context);

            A.CallTo(() => index.RemoveAsync(schema.Id))
            .MustHaveHappened();
        }
示例#7
0
        public async Task Should_remove_schema_from_index_if_deleted_and_exists()
        {
            var(schema, _) = SetupSchema(isDeleted: true);

            var command = new DeleteSchema {
                SchemaId = schemaId, AppId = appId
            };

            var context =
                new CommandContext(command, commandBus)
                .Complete();

            await sut.HandleAsync(context);

            A.CallTo(() => cache.RemoveAsync(schema.Id))
            .MustHaveHappened();
        }
示例#8
0
 public void Delete(DeleteSchema command)
 {
     RaiseEvent(SimpleMapper.Map(command, new SchemaDeleted()));
 }
示例#9
0
 public static void CanDelete(Schema schema, DeleteSchema command)
 {
     Guard.NotNull(command, nameof(command));
 }
示例#10
0
        public void CanDelete_should_not_throw_exception()
        {
            var command = new DeleteSchema();

            GuardSchema.CanDelete(schema_0, command);
        }
示例#11
0
 public void Delete(DeleteSchema command)
 {
     RaiseEvent(command, new SchemaDeleted());
 }
示例#12
0
        private async Task OnDeleteAsync(DeleteSchema delete)
        {
            await InvalidateItAsync(delete.AppId.Id, delete.SchemaId.Id, delete.SchemaId.Name);

            await Cache(delete.AppId.Id).RemoveAsync(delete.SchemaId.Id);
        }
 protected Task On(DeleteSchema command, CommandContext context)
 {
     return(handler.UpdateAsync <SchemaDomainObject>(context, s => s.Delete(command)));
 }
示例#14
0
 private void Delete(DeleteSchema command)
 {
     Raise(command, new SchemaDeleted());
 }
示例#15
0
 public static void CanDelete(DeleteSchema command)
 {
     Guard.NotNull(command);
 }