public virtual void Update(DynamicParameter dynamicParameter)
        {
            CheckDynamicParameter(dynamicParameter);

            using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
            {
                _dynamicParameterStore.Update(dynamicParameter);
                uow.Complete();
            }

            DynamicParameterCache.Set(dynamicParameter.Id, dynamicParameter);
        }
        public virtual async Task AddAsync(DynamicParameter dynamicParameter)
        {
            CheckDynamicParameter(dynamicParameter);

            using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
            {
                await _dynamicParameterStore.AddAsync(dynamicParameter);

                await uow.CompleteAsync();
            }

            await DynamicParameterCache.SetAsync(dynamicParameter.Id, dynamicParameter);
        }
        protected virtual void CheckDynamicParameter(DynamicParameter dynamicParameter)
        {
            if (dynamicParameter == null)
            {
                throw new ArgumentNullException(nameof(dynamicParameter));
            }

            if (dynamicParameter.ParameterName.IsNullOrWhiteSpace())
            {
                throw new ArgumentNullException(nameof(dynamicParameter.ParameterName));
            }

            if (!_dynamicEntityParameterDefinitionManager.ContainsInputType(dynamicParameter.InputType))
            {
                throw new ApplicationException($"Input type is invalid, if you want to use \"{dynamicParameter.InputType}\" input type, define it in DynamicEntityParameterDefinitionProvider.");
            }
        }
Exemplo n.º 4
0
 public DynamicParameterValue(DynamicParameter dynamicParameter, string value, long?tenantId)
 {
     Value              = value;
     TenantId           = tenantId;
     DynamicParameterId = dynamicParameter.Id;
 }
 public virtual Task UpdateAsync(DynamicParameter dynamicParameter)
 {
     return(_dynamicParameterRepository.UpdateAsync(dynamicParameter));
 }
 public virtual void Update(DynamicParameter dynamicParameter)
 {
     _dynamicParameterRepository.Update(dynamicParameter);
 }
 public virtual Task AddAsync(DynamicParameter dynamicParameter)
 {
     return(_dynamicParameterRepository.InsertAsync(dynamicParameter));
 }
 public virtual void Add(DynamicParameter dynamicParameter)
 {
     _dynamicParameterRepository.Insert(dynamicParameter);
 }