本文整理汇总了C#中System.ServiceModel.Dispatcher.ClientOperation类的典型用法代码示例。如果您正苦于以下问题:C# ClientOperation类的具体用法?C# ClientOperation怎么用?C# ClientOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientOperation类属于System.ServiceModel.Dispatcher命名空间,在下文中一共展示了ClientOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZipCodeInspector
void IOperationBehavior.ApplyClientBehavior(OperationDescription operationDescription,
ClientOperation clientOperation)
{
ZipCodeInspector zipCodeInspector = new ZipCodeInspector();
clientOperation.ParameterInspectors.Add(zipCodeInspector);
}
示例2: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
{
var dataContractSerializerOperationBehavior =
description.Behaviors.Find<DataContractSerializerOperationBehavior>();
dataContractSerializerOperationBehavior.DataContractResolver =
new ProxyDataContractResolver();
}
示例3: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
{
clientOperation.Formatter = new RestClientMessageFormatter(clientOperation.Formatter
, operationDescription
, this.Mapper
, this.Configuration);
}
示例4: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
{
Console.WriteLine("{0}: ", clientOperation.Name);
IClientMessageFormatter formatter = clientOperation.Formatter;
Console.WriteLine("\t{0}", formatter.GetType().Name);
if (formatter.GetType().Name != "CompositeClientFormatter")
{
return;
}
object innerFormatter = this.GetField(formatter, "request");
Console.WriteLine("\t\t{0}", innerFormatter.GetType().Name);
if (innerFormatter.GetType().Name == "UriTemplateClientFormatter")
{
innerFormatter = this.GetField(innerFormatter, "inner");
Console.WriteLine("\t\t\t{0}", innerFormatter.GetType().Name);
return;
}
if (innerFormatter.GetType().Name == "ContentTypeSettingClientMessageFormatter")
{
innerFormatter = this.GetField(innerFormatter, "innerFormatter");
Console.WriteLine("\t\t\t{0}", innerFormatter.GetType().Name);
if (innerFormatter.GetType().Name == "UriTemplateClientFormatter")
{
innerFormatter = this.GetField(innerFormatter, "inner");
Console.WriteLine("\t\t\t\t{0}", innerFormatter.GetType().Name);
}
}
}
示例5: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription description, ClientOperation runtime)
{
if (_runtime == runtime.Parent)
{
//在之前的创建的 Formatter 的基础上,装饰新的 Formatter
runtime.Formatter = new BinaryFormatterAdapter(description.Name, runtime.SyncMethod.GetParameters(), runtime.Formatter, runtime.Action);
}
}
示例6: ApplyClientBehavior
/// <summary>
/// Apply the client behavior by requiring
/// the use of the NetDataContractSerializer.
/// </summary>
/// <param name="description">Operation description.</param>
/// <param name="proxy">Client operation object.</param>
public void ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
{
description.Behaviors.Remove<DataContractSerializerOperationBehavior>();
//直接让行为起作用,否则优先级的效果会不对。
IOperationBehavior ndcob = new NetDataContractOperationBehavior(description);
ndcob.ApplyClientBehavior(description, proxy);
//description.Behaviors.Add(new NetDataContractOperationBehavior(description));
}
示例7: GetFormatterFromRuntime
internal static IClientMessageFormatter GetFormatterFromRuntime(OperationDescription operationDescription)
{
ClientOperation clientOperation = new ClientOperation(DummyClientRuntime, operationDescription.Name, operationDescription.Messages[0].Action);
foreach (IOperationBehavior behavior in operationDescription.Behaviors)
{
behavior.ApplyClientBehavior(operationDescription, clientOperation);
}
return clientOperation.Formatter;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ClientOperationFormatterProvider.cs
示例8: ApplyClientBehavior
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
foreach (ClientOperation clientOperation in clientRuntime.ClientOperations)
{
if (clientOperation.Name == "TestFaultWithKnownType")
{
testFaultWithKnownTypeClientOp = clientOperation;
return;
}
}
throw new Exception("Expected TestFaultWithKnownType in the ClientOperations, Actual: TestFaultWithKnownType NOT Found");
}
示例9: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
{
clientOperation.SerializeRequest = true;
clientOperation.DeserializeReply = true;
var dataContractFormatAttribute = operationDescription.SyncMethod.GetCustomAttributes(typeof(DataContractFormatAttribute), true).FirstOrDefault() as DataContractFormatAttribute;
if (null == dataContractFormatAttribute)
{
dataContractFormatAttribute = new DataContractFormatAttribute();
}
var dataContractSerializerOperationBehavior = operationDescription.Behaviors.Find<DataContractSerializerOperationBehavior>();
clientOperation.Formatter = new CompressionMessageFormatter(this.Algorithm, operationDescription, dataContractFormatAttribute, dataContractSerializerOperationBehavior);
}
示例10: ProxyOperationRuntime
internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent)
{
if (operation == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation");
if (parent == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");
this.parent = parent;
this.formatter = operation.Formatter;
this.isInitiating = operation.IsInitiating;
this.isOneWay = operation.IsOneWay;
this.isTerminating = operation.IsTerminating;
this.isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled;
this.name = operation.Name;
this.parameterInspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors);
this.faultFormatter = operation.FaultFormatter;
this.serializeRequest = operation.SerializeRequest;
this.deserializeReply = operation.DeserializeReply;
this.action = operation.Action;
this.replyAction = operation.ReplyAction;
this.beginMethod = operation.BeginMethod;
this.syncMethod = operation.SyncMethod;
this.taskMethod = operation.TaskMethod;
this.TaskTResult = operation.TaskTResult;
if (this.beginMethod != null)
{
this.inParams = ServiceReflector.GetInputParameters(this.beginMethod, true);
if (this.syncMethod != null)
{
this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false);
}
else
{
this.outParams = NoParams;
}
this.endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true);
this.returnParam = operation.EndMethod.ReturnParameter;
}
else if (this.syncMethod != null)
{
this.inParams = ServiceReflector.GetInputParameters(this.syncMethod, false);
this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false);
this.returnParam = this.syncMethod.ReturnParameter;
}
if (this.formatter == null && (serializeRequest || deserializeReply))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ClientRuntimeRequiresFormatter0, this.name)));
}
}
示例11: ProxyOperationRuntime
internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent)
{
if (operation == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation");
if (parent == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");
_parent = parent;
_formatter = operation.Formatter;
_isInitiating = operation.IsInitiating;
_isOneWay = operation.IsOneWay;
_isTerminating = operation.IsTerminating;
_isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled;
_name = operation.Name;
_parameterInspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors);
_faultFormatter = operation.FaultFormatter;
_serializeRequest = operation.SerializeRequest;
_deserializeReply = operation.DeserializeReply;
_action = operation.Action;
_replyAction = operation.ReplyAction;
_beginMethod = operation.BeginMethod;
_syncMethod = operation.SyncMethod;
_taskMethod = operation.TaskMethod;
this.TaskTResult = operation.TaskTResult;
if (_beginMethod != null)
{
_inParams = ServiceReflector.GetInputParameters(_beginMethod, true);
if (_syncMethod != null)
{
_outParams = ServiceReflector.GetOutputParameters(_syncMethod, false);
}
else
{
_outParams = Array.Empty<ParameterInfo>();
}
_endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true);
_returnParam = operation.EndMethod.ReturnParameter;
}
else if (_syncMethod != null)
{
_inParams = ServiceReflector.GetInputParameters(_syncMethod, false);
_outParams = ServiceReflector.GetOutputParameters(_syncMethod, false);
_returnParam = _syncMethod.ReturnParameter;
}
if (_formatter == null && (_serializeRequest || _deserializeReply))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.ClientRuntimeRequiresFormatter0, _name)));
}
}
示例12:
void IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
{
if (description == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
}
if (proxy == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("proxy");
}
if (proxy.Formatter == null)
{
bool flag;
bool flag2;
proxy.Formatter = (IClientMessageFormatter) this.GetFormatter(description, out flag, out flag2, true);
proxy.SerializeRequest = flag;
proxy.DeserializeReply = flag2;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:DataContractSerializerOperationBehavior.cs
示例13: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
{
Console.WriteLine("{0}: ", clientOperation.Name);
IClientMessageFormatter formatter = clientOperation.Formatter;
Console.WriteLine("\t{0}", formatter.GetType().Name);
if (formatter.GetType().Name != "CompositeClientFormatter")
{
return;
}
object innerFormatter = this.GetField(formatter, "reply");
Console.WriteLine("\t\t{0}", innerFormatter.GetType().Name);
if (innerFormatter.GetType().Name == "DemultiplexingClientMessageFormatter")
{
Dictionary<WebContentFormat, IClientMessageFormatter> formatters = this.GetField(innerFormatter,"formatters") as Dictionary<WebContentFormat, IClientMessageFormatter>;
Console.WriteLine("\t\t\t{0, -4}: {1}", "Xml", formatters[WebContentFormat.Xml].GetType().Name);
Console.WriteLine("\t\t\t{0, -4}: {1}", "Json", formatters[WebContentFormat.Json].GetType().Name);
}
}
示例14: GetFormatterFromRuntime
internal static IClientMessageFormatter GetFormatterFromRuntime(OperationDescription operationDescription)
{
System.ServiceModel.Dispatcher.ClientOperation clientOperation = new System.ServiceModel.Dispatcher.ClientOperation(DummyClientRuntime, operationDescription.Name, operationDescription.Messages[0].Action);
// Default to DataContractSerializerOperationBehavior
if (operationDescription.Behaviors.Count == 0)
{
IOperationBehavior operationBehavior = new DataContractSerializerOperationBehavior(operationDescription);
operationBehavior.ApplyClientBehavior(operationDescription, clientOperation);
}
else
{
foreach (IOperationBehavior operationBehavior in operationDescription.Behaviors)
{
operationBehavior.ApplyClientBehavior(operationDescription, clientOperation);
}
}
return clientOperation.Formatter;
}
示例15: ApplyClientBehavior
public void ApplyClientBehavior(OperationDescription operationDescription,
ClientOperation clientOperation)
{
}