void InspectOutputsCore(ref MessageRpc rpc) { int offset = this.Parent.ParameterInspectorCorrelationOffset; bool outputTiming = DS.ParameterInspectorIsEnabled(); Stopwatch sw = null; if (outputTiming) { sw = new Stopwatch(); } for (int i = this.ParameterInspectors.Length - 1; i >= 0; i--) { IParameterInspector inspector = this.ParameterInspectors[i]; if (outputTiming) { sw.Restart(); } inspector.AfterCall(this.Name, rpc.OutputParameters, rpc.ReturnParameter, rpc.Correlation[offset + i]); if (outputTiming) { DS.ParameterInspectorAfter(inspector.GetType(), sw.Elapsed); } if (TD.ParameterInspectorAfterCallInvokedIsEnabled()) { TD.ParameterInspectorAfterCallInvoked(rpc.EventTraceActivity, inspector.GetType().FullName); } } }
void InspectInputsCore(ref MessageRpc rpc) { int offset = this.Parent.ParameterInspectorCorrelationOffset; bool outputTiming = DS.ParameterInspectorIsEnabled(); Stopwatch sw = null; if (outputTiming) { sw = new Stopwatch(); } for (int i = 0; i < this.ParameterInspectors.Length; i++) { IParameterInspector inspector = this.ParameterInspectors[i]; if (outputTiming) { sw.Restart(); } rpc.Correlation[offset + i] = inspector.BeforeCall(this.Name, rpc.InputParameters); if (outputTiming) { DS.ParameterInspectorBefore(inspector.GetType(), sw.Elapsed); } if (TD.ParameterInspectorBeforeCallInvokedIsEnabled()) { TD.ParameterInspectorBeforeCallInvoked(rpc.EventTraceActivity, inspector.GetType().FullName); } } }
public ValidateDataAnnotationsBehavior() { var validators = new IObjectValidator[] { new NullCheckObjectValidator(), new DataAnnotationsObjectValidator(), new ValidatableObjectValidator() }; _validatingParameterInspector = new ValidatingParameterInspector(validators); }
void InspectOutputsCore(ref MessageRpc rpc) { for (int i = this.ParameterInspectors.Length - 1; i >= 0; i--) { IParameterInspector inspector = this.ParameterInspectors[i]; inspector.AfterCall(this.Name, rpc.OutputParameters, rpc.ReturnParameter, rpc.Correlation[i]); if (TD.ParameterInspectorAfterCallInvokedIsEnabled()) { TD.ParameterInspectorAfterCallInvoked(rpc.EventTraceActivity, this.ParameterInspectors[i].GetType().FullName); } } }
void InspectInputsCore(ref MessageRpc rpc) { for (int i = 0; i < this.ParameterInspectors.Length; i++) { IParameterInspector inspector = this.ParameterInspectors[i]; rpc.Correlation[i] = inspector.BeforeCall(this.Name, rpc.InputParameters); if (TD.ParameterInspectorBeforeCallInvokedIsEnabled()) { TD.ParameterInspectorBeforeCallInvoked(rpc.EventTraceActivity, this.ParameterInspectors[i].GetType().FullName); } } }
private void InspectOutputsCore(ref MessageRpc rpc) { for (int i = ParameterInspectors.Length - 1; i >= 0; i--) { IParameterInspector inspector = ParameterInspectors[i]; inspector.AfterCall(Name, rpc.OutputParameters, rpc.ReturnParameter, rpc.Correlation[i]); if (WcfEventSource.Instance.ParameterInspectorAfterCallInvokedIsEnabled()) { WcfEventSource.Instance.ParameterInspectorAfterCallInvoked(rpc.EventTraceActivity, ParameterInspectors[i].GetType().FullName); } } }
private void InspectInputsCore(ref MessageRpc rpc) { for (int i = 0; i < ParameterInspectors.Length; i++) { IParameterInspector inspector = ParameterInspectors[i]; rpc.Correlation[i] = inspector.BeforeCall(Name, rpc.InputParameters); if (WcfEventSource.Instance.ParameterInspectorBeforeCallInvokedIsEnabled()) { WcfEventSource.Instance.ParameterInspectorBeforeCallInvoked(rpc.EventTraceActivity, ParameterInspectors[i].GetType().FullName); } } }
public void BeforeEachTest() { _operationName = Guid.NewGuid().ToString(); _operation = new CancellableOperationDescription(0, null, "Operation full name"); var operationByName = new Dictionary <string, CancellableOperationDescription> { { _operationName, _operation } }; _operationManager = new Mock <IClientOperationManager>(MockBehavior.Strict); _sut = new ClientOperationParameterInspector(_operationManager.Object, operationByName); }
public ValidateDataAnnotationsServiceBehavior() { var validators = new List <IObjectValidator> { new NullCheckObjectValidator(), new DataAnnotationsObjectValidator(), new ValidatableObjectValidator() }; var errorMessageGenerator = new ErrorMessageGenerator(); _validatingParameterInspector = new ValidatingParameterInspector(validators, errorMessageGenerator); }
void InspectOutputsCore(MessageRpc rpc) { int offset = Parent.ParameterInspectorCorrelationOffset; for (int i = ParameterInspectors.Length - 1; i >= 0; i--) { IParameterInspector inspector = ParameterInspectors[i]; inspector.AfterCall(Name, rpc.OutputParameters, rpc.ReturnParameter, rpc.Correlation[offset + i]); //if (TD.ParameterInspectorAfterCallInvokedIsEnabled()) //{ // TD.ParameterInspectorAfterCallInvoked(rpc.EventTraceActivity, this.ParameterInspectors[i].GetType().FullName); //} } }
void InspectInputsCore(MessageRpc rpc) { int offset = Parent.ParameterInspectorCorrelationOffset; for (int i = 0; i < ParameterInspectors.Length; i++) { IParameterInspector inspector = ParameterInspectors[i]; rpc.Correlation[offset + i] = inspector.BeforeCall(Name, rpc.InputParameters); //if (TD.ParameterInspectorBeforeCallInvokedIsEnabled()) //{ // TD.ParameterInspectorBeforeCallInvoked(rpc.EventTraceActivity, this.ParameterInspectors[i].GetType().FullName); //} } }
/// <summary> /// Initializes a new instance of the <see cref="ValidateDataAnnotationsBehavior" /> class. /// </summary> /// <param name="validationResultsLogger">Optional validation results logger. It has to implement the interface <see cref="IValidationResultsLogger"/></param> public ValidateDataAnnotationsBehavior(Type validationResultsLogger = null) { if (validationResultsLogger != null) { if (!typeof(IValidationResultsLogger).IsAssignableFrom(validationResultsLogger)) { throw new ArgumentException($"The type of {validationResultsLogger} doesn't implement the interface '{typeof(IValidationResultsLogger)}'!"); } _validationResultsLogger = (IValidationResultsLogger)Activator.CreateInstance(validationResultsLogger); } _validators = new List <IObjectValidator> { new NullCheckObjectValidator(), new DataAnnotationsObjectValidator(), new ValidatableObjectValidator() }; var errorMessageGenerator = new ErrorMessageGenerator(); _defaultValidatingParameterInspector = new ValidatingParameterInspector(_validators, errorMessageGenerator, _validationResultsLogger); }