0
SperseDev created
Hi,
I have simple data entity and appropriated dto entity
[Table("Packages", Schema = "Test")]
public class Package : FullAuditedEntity, IMustHaveTenant
{
public int TenantId { get; set; }
[Required]
[MaxLength(50)]
public string Name { get; set; }
}
[AutoMapFrom(typeof(Package))]
public class PackageDto : FullAuditedEntityDto
{
public int TenantId { get; set; }
public string Name { get; set; }
}
I have public (without authorization attribute) service:
public class PackageAppService : AppServiceBase, IPackageAppService
{
private readonly IRepository<Package> _packageRepository;
public PackageAppService(IRepository<Package> packageRepository)
{
_packageRepository = packageRepository;
}
public ListResultDto<PackageDto> GetAll()
{
var packages = _packageRepository.GetAll();
return new ListResultDto<PackageDto>(ObjectMapper.Map<List<PackageDto>>(packages));
}
}
When I call service method GetAll from host ( or public) context I receive list of all packages not filtered by tenantid null. When I use interface IMayHaveTenant instead of IMustHaveTenant all work correct. It's a bug?
Thanks.
1 Answer(s)
-
0
Hi,
This is by design actually, you can read this section for more info <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Data-Filters#DocMustHaveTenant">https://aspnetboilerplate.com/Pages/Doc ... HaveTenant</a>.
Thanks.