Closed weiwxg closed 3 years ago
Full steps are needed to reproduce the problem.
// entity
public class Foo : FullAuditedAggregateRoot<Guid>
{
}
// dbcontext
public class BasicSettingDbContext : AbpDbContext<BasicSettingDbContext>
{
// without this line.
// public DbSet<Foo> Fooes { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<Foo>(b =>
{
b.ToTable(BasicSettingConsts.DbTablePrefix + "Fooes", BasicSettingConsts.DbSchema);
b.ConfigureByConvention();
});
}
}
// appservice
public class FooAppService : IFooAppService
{
public async Task DeleteAsync(Guid id)
{
return repository.DeleteAsync(id);
}
public async Task<FooDto> GetAsync(Guid id)
{
return ObjectMapper.Map<Foo, FooDto>(await repository.GetAsync(id));
}
}
Firstly, i call HttpGet
localhost:5201/api/foos
, return 1 items:
{
"id": "39fdbee9-14b5-365b-69a0-360cf23ba326",
"isDeleted": 0,
"DeleterId": null,
"DeletionTime": null
}
Then, i call HttpDelete
localhost:5201/api/foos/39fdbee9-14b5-365b-69a0-360cf23ba326
, return 204.
Obviously, the data is deleted.
However, when I call the HttpGet
localhost:5201/api/foos
again, I can find the deleted data
{
"id": "39fdbee9-14b5-365b-69a0-360cf23ba326",
"isDeleted": 1,
"DeleterId": "39fd76e0-8e06-6ced-8a88-8f605975b625",
"DeletionTime": "2021-07-16 11:44:40.000"
}
Abp will get EntityTypes
by DbSet<>
, so you have to add it to AbpDbContextAbpDbContext
I have a entity which not set
DbSet<?>
Property in DbContext. Then when i useRepository.GetAsync(id)
, i get the deleted item!