abp主机用户不过滤租户id

using (_unitOfWorkManager.Current.DisableFilter(DataFilterUtil.NowDisableFilter(AbpSession)))
{
var teacherinfo =
_teacherinfoRepository
.GetAll()
.FirstOrDefault(q => q.Id == input.Id);

if (teacherinfo == null)
{
throw new UserFriendlyException("没有数据");
}

ObjectMapper.Map(input, teacherinfo);
var info = await _teacherinfoRepository.UpdateAsync(teacherinfo);
return info.MapTo<TeacherInfoDto>();
}

 

public static class DataFilterUtil
{
public static string[] NowDisableFilter(IAbpSession AbpSession)
{
if (AbpSession.MultiTenancySide == MultiTenancySides.Host)
{
return new string[]{ AbpDataFilters.MayHaveTenant, AbpDataFilters.MustHaveTenant };
}
else
{
return new string[0] { };
}
}
}

posted @ 2018-05-21 18:47  forhells  阅读(273)  评论(0编辑  收藏  举报