本文整理汇总了C#中IOperation类的典型用法代码示例。如果您正苦于以下问题:C# IOperation类的具体用法?C# IOperation怎么用?C# IOperation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOperation类属于命名空间,在下文中一共展示了IOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecorateEnumerableForExecution
/// <summary>
/// Add a decorator to the enumerable for additional processing
/// </summary>
/// <param name="operation">The operation.</param>
/// <param name="enumerator">The enumerator.</param>
protected override IEnumerable<Row> DecorateEnumerableForExecution(IOperation operation, IEnumerable<Row> enumerator)
{
foreach (Row row in new EventRaisingEnumerator(operation, enumerator))
{
yield return row;
}
}
示例2: GetInterceptors
public override IEnumerable<IOperationInterceptor> GetInterceptors(IOperation operation)
{
return new[]
{
new PrincipalAuthorizationInterceptor(DependencyManager.GetService<ICommunicationContext>())
};
}
示例3: DeploymentCreateForecastWorker
public DeploymentCreateForecastWorker(
IDeployment deployment,
IOperation operation,
Guid subscriptionId,
string certificateThumbprint,
string serviceName,
string deploymentSlot,
ScheduleDay[] scheduleDays,
string deploymentName,
Uri packageUrl,
string label,
string configurationFilePath,
bool startDeployment,
bool treatWarningsAsError,
int pollingIntervalInMinutes)
: base(GetWorkerId(serviceName, deploymentSlot))
{
this.deployment = deployment;
this.operation = operation;
this.subscriptionId = subscriptionId;
this.certificateThumbprint = certificateThumbprint;
this.serviceName = serviceName;
this.deploymentSlot = deploymentSlot;
this.scheduleDays = scheduleDays;
this.deploymentName = deploymentName;
this.packageUrl = packageUrl;
this.label = label;
this.configurationFilePath = configurationFilePath;
this.startDeployment = startDeployment;
this.treatWarningsAsError = treatWarningsAsError;
this.pollingIntervalInMinutes = pollingIntervalInMinutes;
}
示例4: BeforeExecute
public override bool BeforeExecute(IOperation operation)
{
foreach (InputMember input in operation.Inputs) {
if (input == null)
continue;
var parameter = input.Binder.BuildObject();
try {
IValidator validator = ResolveValidator(parameter);
if (validator == null)
continue;
var errors = validator.Validate(parameter.Instance, operation.Name.ToUpper()).ToList();
if (errors.Count > 0) {
_context.OperationResult = new OperationResult.BadRequest {
ResponseResource = parameter.Instance,
Errors = errors
};
return false;
}
} catch (Exception ex) {}
}
return true;
}
示例5: GetInterceptors
public override IEnumerable<IOperationInterceptor> GetInterceptors(IOperation operation)
{
return new[]
{
new RequiresAuthenticationInterceptor(DependencyManager.GetService<ICommunicationContext>())
};
}
示例6: DoOperation
protected virtual OperationStatus DoOperation(IOperation operation)
{
Logger.LogEvent(string.Format("Doing operation of type {0} syncronously.", operation.GetType().Name), this, ImportanceLevels.gUnimportant);
var status = operation.RunSync();
Logger.LogEvent(string.Format("Operation of type {0} is done.", operation.GetType().Name), this, ImportanceLevels.gUnimportant);
return status;
}
示例7: clearOpInfo
public void clearOpInfo(IOperation op)
{
cur_checksum.Text = "";
app_path.Text = "";
appName.Text = "";
appIcon.Image = null;
}
示例8: DecorateEnumerableForExecution
/// <summary>
/// Add a decorator to the enumerable for additional processing
/// </summary>
/// <param name="operation">The operation.</param>
/// <param name="enumerator">The enumerator.</param>
protected override IEnumerable<Row> DecorateEnumerableForExecution(IOperation operation, IEnumerable<Row> enumerator)
{
ThreadSafeEnumerator<Row> threadedEnumerator = new ThreadSafeEnumerator<Row>();
ThreadPool.QueueUserWorkItem(delegate
{
try
{
foreach (Row t in new EventRaisingEnumerator(operation, enumerator))
{
threadedEnumerator.AddItem(t);
}
}
catch (Exception e)
{
Error(e, "Failed to execute operation {0}", operation);
threadedEnumerator.MarkAsFinished();
throw;
}
finally
{
threadedEnumerator.MarkAsFinished();
}
});
return threadedEnumerator;
}
示例9: OperationFailed
public void OperationFailed(IOperation operation, Exception error)
{
if(!OperationFailures.ContainsKey(operation))
OperationFailures.Add(operation, new List<Exception>());
OperationFailures[operation].Add(error);
}
示例10: WaitForResultOfRequest
protected void WaitForResultOfRequest(ILog logger, string workerTypeName, IOperation operation, Guid subscriptionId, string certificateThumbprint, string requestId)
{
OperationResult operationResult = new OperationResult();
operationResult.Status = OperationStatus.InProgress;
bool done = false;
while (!done)
{
operationResult = operation.StatusCheck(subscriptionId, certificateThumbprint, requestId);
if (operationResult.Status == OperationStatus.InProgress)
{
string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}', the operation was found to be in process, waiting for '{3}' seconds.", workerTypeName, this.Id, requestId, FiveSecondsInMilliseconds / 1000);
logger.Info(logMessage);
Thread.Sleep(FiveSecondsInMilliseconds);
}
else
{
done = true;
}
}
if (operationResult.Status == OperationStatus.Failed)
{
string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}' and it failed. The code was '{3}' and message '{4}'.", workerTypeName, this.Id, requestId, operationResult.Code, operationResult.Message);
logger.Error(logMessage);
}
else if (operationResult.Status == OperationStatus.Succeeded)
{
string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}' and it succeeded. The code was '{3}' and message '{4}'.", workerTypeName, this.Id, requestId, operationResult.Code, operationResult.Message);
logger.Info(logMessage);
}
}
示例11: HandleOperation
public void HandleOperation(IOperation operation)
{
var handlerType = typeof (IOperationHandler<>).MakeGenericType(operation.GetType());
var handler = _handlerFactory(handlerType);
handlerType.GetMethod("Handle").Invoke(handler, new object[] {operation});
}
示例12: CanPassOnRemovedProcessedEvents
public void CanPassOnRemovedProcessedEvents()
{
//Arrange
var branching = new TestAbstractBranchingOperation();
const int nOps = 5;
var ops = new IOperation[nOps];
for (var i = 0; i < nOps; i++)
{
ops[i] = MockRepository.GenerateMock<IOperation>();
ops[i].Expect(x => x.OnRowProcessed += processAction);
ops[i].Expect(x => x.OnRowProcessed -= processAction);
branching.Add(ops[i]);
}
//Act
branching.OnRowProcessed += processAction;
branching.OnRowProcessed -= processAction;
//Assert
foreach (var op in ops)
op.VerifyAllExpectations();
var handlerInfos = typeof(AbstractOperation).GetField("OnRowProcessed", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
Assert.Equal(1, ((Delegate)(handlerInfos.GetValue(branching))).GetInvocationList().Length);
}
示例13: CreateBehaviors
public IList<OperationBehavior> CreateBehaviors(IOperation operation, WorkflowConfiguration configuration)
{
Verify.NotNull(operation, nameof(operation));
var decoratorAttributes = operation.GetType().GetCustomAttributes(typeof(OperationBehaviorAttribute), inherit: false);
return decoratorAttributes.OfType<OperationBehaviorAttribute>().Select(b => b.CreateBehavior(configuration)).ToList();
}
示例14: ResolveTouchClick
private void ResolveTouchClick(IPuzzle puzzle, IOperation op)
{
IQuad quad = puzzle[op.row, op.column];
if (quad.value == QuadValue.Front || quad.value == QuadValue.Back)
{
List<Tween> playings = DOTween.PlayingTweens();
if (playings != null)
{
playings.ForEach((Tween each) =>
{
if (each.id != null && each.id.ToString().StartsWith(Style.QuadUnifiedRotateId))
{
each.Kill(true);
}
});
}
puzzle.touchEnable = false;
TweenDepot depot = new TweenDepot();
ResolvePresent(depot, puzzle, op, op, 0);
Sequence sequence = depot.ToSequence();
sequence.SetId(Style.QuadUnifiedRotateId);
sequence.OnComplete(() =>
{
ResolveTouchData(puzzle, op);
if (IsSolved(puzzle))
{
puzzle.solved = true;
}
else
{
puzzle.touchEnable = true;
}
});
}
}
示例15: BeforeExecute
public override bool BeforeExecute(IOperation operation)
{
if ((InRoles == null || InRoles.Length == 0) && (Users == null || Users.Length == 0))
return true;
try
{
if (InRoles != null)
if (InRoles.Any(role => _context.User.IsInRole(role)))
{
return true;
}
if (Users != null)
if (Users.Any(user => _context.User.Identity.Name == user))
{
return true;
}
}
catch
{
// todo: decide where to log this error.
}
_context.OperationResult = new OperationResult.Unauthorized();
return false;
}