protected virtual TenantCacheItem GetCacheItem(Guid?id, string name) { var cacheKey = CalculateCacheKey(id, name); var cacheItem = Cache.Get(cacheKey, considerUow: true); if (cacheItem != null) { return(cacheItem); } if (id.HasValue) { using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { var tenant = TenantRepository.FindById(id.Value); return(SetCache(cacheKey, tenant)); } } if (!name.IsNullOrWhiteSpace()) { using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { var tenant = TenantRepository.FindByName(name); return(SetCache(cacheKey, tenant)); } } throw new AbpException("Both id and name can't be invalid."); }
public virtual TenantConfiguration Find(string name) { using (CurrentTenant.Change(null)) { var tenant = TenantRepository.FindByName(name); if (tenant == null) { return(null); } return(ObjectMapper.Map <Tenant, TenantConfiguration> (tenant)); } }
public virtual TenantConfiguration Find(string name) { using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { var tenant = TenantRepository.FindByName(name); if (tenant == null) { return(null); } return(ObjectMapper.Map <Tenant, TenantConfiguration>(tenant)); } }