public List <DynamicEntityProperty> GetAll(string entityFullName) { var allProperties = DynamicEntityPropertyStore.GetAll(entityFullName); allProperties = allProperties.Where(dynamicEntityProperty => _dynamicPropertyPermissionChecker.IsGranted(dynamicEntityProperty.DynamicPropertyId)) .ToList(); return(allProperties); }
public virtual DynamicEntityProperty Get(int id) { var tenantId = GetCurrentTenantId(); var cacheKey = GetCacheKey(id, tenantId); var entityProperty = DynamicEntityPropertyCache.Get(cacheKey, () => DynamicEntityPropertyStore.Get(id)); _dynamicPropertyPermissionChecker.CheckPermission(entityProperty.DynamicPropertyId); return(entityProperty); }
public virtual async Task <DynamicEntityProperty> GetAsync(int id) { var tenantId = GetCurrentTenantId(); var cacheKey = GetCacheKey(id, tenantId); var entityProperty = await DynamicEntityPropertyCache.GetAsync(cacheKey, () => DynamicEntityPropertyStore.GetAsync(id)); await _dynamicPropertyPermissionChecker.CheckPermissionAsync(entityProperty.DynamicPropertyId); return(entityProperty); }
public virtual async Task UpdateAsync(DynamicEntityProperty dynamicEntityProperty) { CheckEntityName(dynamicEntityProperty.EntityFullName); await _dynamicPropertyPermissionChecker.CheckPermissionAsync(dynamicEntityProperty.DynamicPropertyId); using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) { await DynamicEntityPropertyStore.UpdateAsync(dynamicEntityProperty); await uow.CompleteAsync(); } var cacheKey = GetCacheKey(dynamicEntityProperty.Id, dynamicEntityProperty.TenantId); await DynamicEntityPropertyCache.SetAsync(cacheKey, dynamicEntityProperty); }
public virtual void Update(DynamicEntityProperty dynamicEntityProperty) { CheckEntityName(dynamicEntityProperty.EntityFullName); _dynamicPropertyPermissionChecker.CheckPermission(dynamicEntityProperty.DynamicPropertyId); using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) { DynamicEntityPropertyStore.Update(dynamicEntityProperty); uow.Complete(); } var cacheKey = GetCacheKey(dynamicEntityProperty.Id, dynamicEntityProperty.TenantId); DynamicEntityPropertyCache.Set(cacheKey, dynamicEntityProperty); }
public async Task <List <DynamicEntityProperty> > GetAllAsync(string entityFullName) { var allProperties = await DynamicEntityPropertyStore.GetAllAsync(entityFullName); var controlledProperties = new List <DynamicEntityProperty>(); foreach (var dynamicEntityProperty in allProperties) { if (await _dynamicPropertyPermissionChecker.IsGrantedAsync(dynamicEntityProperty.DynamicPropertyId)) { controlledProperties.Add(dynamicEntityProperty); } } return(controlledProperties); }
public virtual async Task DeleteAsync(int id) { var dynamicEntityProperty = await GetAsync(id); //Get checks permission, no need to check it again if (dynamicEntityProperty == null) { return; } await DynamicEntityPropertyStore.DeleteAsync(dynamicEntityProperty.Id); var tenantId = GetCurrentTenantId(); var cacheKey = GetCacheKey(id, tenantId); await DynamicEntityPropertyCache.RemoveAsync(cacheKey); }
public virtual void Delete(int id) { var dynamicEntityProperty = Get(id); //Get checks permission, no need to check it again if (dynamicEntityProperty == null) { return; } DynamicEntityPropertyStore.Delete(dynamicEntityProperty.Id); var tenantId = GetCurrentTenantId(); var cacheKey = GetCacheKey(id, tenantId); DynamicEntityPropertyCache.Remove(cacheKey); }