本文整理汇总了C#中IStoreTransactionScope.ExecuteOperation方法的典型用法代码示例。如果您正苦于以下问题:C# IStoreTransactionScope.ExecuteOperation方法的具体用法?C# IStoreTransactionScope.ExecuteOperation怎么用?C# IStoreTransactionScope.ExecuteOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStoreTransactionScope
的用法示例。
在下文中一共展示了IStoreTransactionScope.ExecuteOperation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoGlobalExecute
/// <summary>
/// Execute the operation against GSM in the current transaction scope.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>
/// Results of the operation.
/// </returns>
public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
{
// If no ranges are specified, blindly mark everything for deletion.
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpFindShardMappingByIdGlobal,
StoreOperationRequestBuilder.FindShardMappingByIdGlobal(_shardMap, _mapping));
}
示例2: DoGlobalPreLocalExecute
/// <summary>
/// Performs the initial GSM operation prior to LSM operations.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Pending operations on the target objects if any.</returns>
public override IStoreResults DoGlobalPreLocalExecute(IStoreTransactionScope ts)
{
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardsGlobalBegin,
StoreOperationRequestBuilder.AddShardGlobal(
this.Id,
this.OperationCode,
false, // undo
_shardMap,
_shard));
}
示例3: DoGlobalExecute
/// <summary>
/// Execute the operation against GSM in the current transaction scope.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>
/// Results of the operation.
/// </returns>
public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
{
IEnumerable<IStoreMapping> mappingsToReplace = this.GetMappingsToPurge(ts);
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpReplaceShardMappingsGlobal,
StoreOperationRequestBuilder.ReplaceShardMappingsGlobalWithoutLogging(
_shardMap,
mappingsToReplace.ToArray(),
_mappingsToAdd.ToArray()));
}
示例4: DoGlobalExecute
/// <summary>
/// Execute the operation against GSM in the current transaction scope.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>
/// Results of the operation.
/// </returns>
public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
{
_loadResults.Clear();
IStoreResults result = ts.ExecuteOperation(
StoreOperationRequestBuilder.SpGetAllShardMapsGlobal,
StoreOperationRequestBuilder.GetAllShardMapsGlobal());
if (result.Result == StoreResult.Success)
{
foreach (IStoreShardMap ssm in result.StoreShardMaps)
{
_ssmCurrent = ssm;
result = ts.ExecuteOperation(
StoreOperationRequestBuilder.SpGetAllShardMappingsGlobal,
StoreOperationRequestBuilder.GetAllShardMappingsGlobal(ssm, null, null));
if (result.Result == StoreResult.Success)
{
_loadResults.Add(
new LoadResult
{
ShardMap = ssm,
Mappings = result.StoreMappings
});
}
else
if (result.Result != StoreResult.ShardMapDoesNotExist)
{
// Ignore some possible failures for Load operation and skip failed
// shard map caching operations.
break;
}
}
}
return result;
}
示例5: DoLocalExecute
/// <summary>
/// Execute the operation against LSM in the current transaction scope.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>
/// Results of the operation.
/// </returns>
public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
{
IStoreResults result = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());
if (result.StoreVersion == null)
{
// Shard not deployed, which is an error condition.
throw new ShardManagementException(
ShardManagementErrorCategory.Recovery,
ShardManagementErrorCode.ShardNotValid,
Errors._Recovery_ShardNotValid,
this.Location,
this.OperationName);
}
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpGetAllShardsLocal,
StoreOperationRequestBuilder.GetAllShardsLocal());
}
示例6: DoLocalExecute
/// <summary>
/// Execute the operation against LSM in the current transaction scope.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>
/// Results of the operation.
/// </returns>
public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
{
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpGetAllShardMappingsLocal,
StoreOperationRequestBuilder.GetAllShardMappingsLocal(_shardMap, _shard, _range));
}
示例7: DoLocalExecute
/// <summary>
/// Execute the operation against LSM in the current transaction scope.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>
/// Results of the operation.
/// </returns>
public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
{
IEnumerable<IStoreMapping> mappingsToRemove = this.GetMappingsToPurge(ts);
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardMappingsLocal,
StoreOperationRequestBuilder.ReplaceShardMappingsLocal(
Guid.NewGuid(), // Create a new Guid so that this operation forces over-writes.
false,
_shardMap,
mappingsToRemove.ToArray(),
_mappingsToAdd.ToArray()));
}
示例8: UndoGlobalPostLocalExecute
/// <summary>
/// Performs the undo of GSM operation after LSM operations.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Pending operations on the target objects if any.</returns>
public override IStoreResults UndoGlobalPostLocalExecute(IStoreTransactionScope ts)
{
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardMappingsGlobalEnd,
StoreOperationRequestBuilder.UpdateShardMappingGlobal(
this.Id,
this.OperationCode,
true, // undo
_patternForKill,
_shardMap,
_mappingSource,
_mappingTarget,
_lockOwnerId));
}
示例9: UndoGlobalPostLocalExecute
/// <summary>
/// Performs the undo of GSM operation after LSM operations.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Pending operations on the target objects if any.</returns>
public override IStoreResults UndoGlobalPostLocalExecute(IStoreTransactionScope ts)
{
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardMappingsGlobalEnd,
StoreOperationRequestBuilder.AddShardMappingGlobal(
this.Id,
this.OperationCode,
true, // undo
_shardMap,
_mapping));
}
示例10: DoLocalSourceExecute
/// <summary>
/// Performs the LSM operation on the source shard.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Result of the operation.</returns>
public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
{
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardMappingsLocal,
StoreOperationRequestBuilder.AddShardMappingLocal(
this.Id,
false,
_shardMap,
_mapping));
}
示例11: DoLocalSourceExecute
/// <summary>
/// Performs the LSM operation on the source shard.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Result of the operation.</returns>
public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
{
IStoreResults result;
if (_updateLocation)
{
result = ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardMappingsLocal,
StoreOperationRequestBuilder.RemoveShardMappingLocal(
this.Id,
false,
_shardMap,
_mappingSource));
}
else
{
result = ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardMappingsLocal,
StoreOperationRequestBuilder.UpdateShardMappingLocal(
this.Id,
false,
_shardMap,
_mappingSource,
_mappingTarget));
}
// We need to treat the kill connection operation separately, the reason
// being that we cannot perform kill operations within a transaction.
if (result.Result == StoreResult.Success && _fromOnlineToOffline)
{
this.KillConnectionsOnSourceShard();
}
return result;
}
示例12: DoLocalSourceExecute
/// <summary>
/// Performs the LSM operation on the source shard.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Result of the operation.</returns>
public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
{
IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());
// Shard not already deployed, just need to add the proper entries.
if (checkResult.StoreVersion == null)
{
// create initial version of LSM
ts.ExecuteCommandBatch(SqlUtils.CreateLocalScript);
// now upgrade LSM to latest version
ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeLocalScript, GlobalConstants.LsmVersionClient));
}
// Now actually add the shard entries.
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpAddShardLocal,
StoreOperationRequestBuilder.AddShardLocal(this.Id, false, _shardMap, _shard));
}
示例13: UndoLocalSourceExecute
/// <summary>
/// Performs the undo of LSM operation on the source shard.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Result of the operation.</returns>
public override IStoreResults UndoLocalSourceExecute(IStoreTransactionScope ts)
{
// Adds back the removed shard entries.
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpAddShardLocal,
StoreOperationRequestBuilder.AddShardLocal(this.Id, true, _shardMap, _shard));
}
示例14: DoLocalSourceExecute
/// <summary>
/// Performs the LSM operation on the source shard.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Result of the operation.</returns>
public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
{
// Now actually add the shard entries.
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpRemoveShardLocal,
StoreOperationRequestBuilder.RemoveShardLocal(this.Id, _shardMap, _shard));
}
示例15: DoGlobalPostLocalExecute
/// <summary>
/// Performs the final GSM operation after the LSM operations.
/// </summary>
/// <param name="ts">Transaction scope.</param>
/// <returns>Pending operations on the target objects if any.</returns>
public override IStoreResults DoGlobalPostLocalExecute(IStoreTransactionScope ts)
{
return ts.ExecuteOperation(
StoreOperationRequestBuilder.SpBulkOperationShardsGlobalEnd,
StoreOperationRequestBuilder.UpdateShardGlobal(
this.Id,
this.OperationCode,
false, // undo
_shardMap,
_shardOld,
_shardNew));
}