Пример #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);
        }
Пример #2
0
        public void RegisterUpdate(UpdateBatch batch, object entity, string json)
        {
            var newVersion     = CombGuidIdGeneration.NewGuid();
            var currentVersion = batch.Versions.Version <T>(Identity(entity));

            ICallback callback = null;

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


            var call = batch.Sproc(_upsertName, callback);



            _sprocWriter(call, (T)entity, batch, _mapping, currentVersion, newVersion);
        }
 public OptimisticConcurrencyCallbackTests()
 {
     theCallback = new OptimisticConcurrencyCallback <Target>(ConcurrencyChecks.Enabled, theId, theVersionTracker, theNewVersion, theOldVersion, v => theCurrentDocVersion = v);
 }
 public OptimisticConcurrencyCallbackTests()
 {
     theCallback = new OptimisticConcurrencyCallback <Target>(theId, theVersionTracker, theNewVersion, theOldVersion);
 }
 public OptimisticConcurrencyCallbackTests()
 {
     theCallback = new OptimisticConcurrencyCallback<Target>(theId, theVersionTracker, theNewVersion, theOldVersion);
 }