Beispiel #1
0
        public void RegisterUpdate(string tenantIdOverride, UpdateStyle updateStyle, UpdateBatch batch, object entity, string json)
        {
            var newVersion     = CombGuidIdGeneration.NewGuid();
            var currentVersion = batch.Versions.Version <T>(Identity(entity));

            ICallback           callback           = null;
            IExceptionTransform exceptionTransform = null;
            var sprocName = determineDbObjectName(updateStyle, batch);

            var tenantId = tenantIdOverride ?? batch.TenantId;

            if (_mapping.UseOptimisticConcurrency && batch.Concurrency == ConcurrencyChecks.Enabled)
            {
                callback = new OptimisticConcurrencyCallback <T>(Identity(entity), batch.Versions, newVersion,
                                                                 currentVersion);
            }

            if (!_mapping.UseOptimisticConcurrency && updateStyle == UpdateStyle.Update)
            {
                callback = new UpdateDocumentCallback <T>(Identity(entity));
            }

            if (updateStyle == UpdateStyle.Insert)
            {
                exceptionTransform = new InsertExceptionTransform <T>(Identity(entity), _mapping.Table.Name);
            }


            var call = batch.Sproc(sprocName, callback, exceptionTransform);

            _sprocWriter(call, (T)entity, batch, _mapping, currentVersion, newVersion, tenantId);
        }
Beispiel #2
0
        public SprocCall Sproc(DbObjectName function, ICallback callback = null, IExceptionTransform exceptionTransform = null)
        {
            if (function == null)
            {
                throw new ArgumentNullException(nameof(function));
            }

            return(Current().Sproc(function, callback, exceptionTransform));
        }
Beispiel #3
0
        public SprocCall Sproc(DbObjectName function, ICallback callback = null, IExceptionTransform exceptionTransform = null)
        {
            if (function == null)
            {
                throw new ArgumentNullException(nameof(function));
            }

            var call = new SprocCall(this, function);

            AddCall(call, callback, exceptionTransform);

            return(call);
        }
Beispiel #4
0
 public void AddCall(IStorageOperation call, ICallback callback = null, IExceptionTransform exceptionTransform = null)
 {
     Calls.Add(call);
     Callbacks.Add(callback);
     ExceptionTransforms.Add(exceptionTransform);
 }