public DataContractSerializerOperationFormatter(OperationDescription description, DataContractFormatAttribute dataContractFormatAttribute, DataContractSerializerOperationBehavior serializerFactory) : base(description, dataContractFormatAttribute.Style == OperationFormatStyle.Rpc, false) { if (description == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description"); } this.serializerFactory = serializerFactory ?? new DataContractSerializerOperationBehavior(description); foreach (System.Type type in description.KnownTypes) { if (this.knownTypes == null) { this.knownTypes = new List<System.Type>(); } if (type == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxKnownTypeNull", new object[] { description.Name }))); } this.ValidateDataContractType(type); this.knownTypes.Add(type); } this.requestMessageInfo = this.CreateMessageInfo(dataContractFormatAttribute, base.RequestDescription, this.serializerFactory); if (base.ReplyDescription != null) { this.replyMessageInfo = this.CreateMessageInfo(dataContractFormatAttribute, base.ReplyDescription, this.serializerFactory); } }
public CompressionMessageFormatter(CompressionAlgorithm algorithm, OperationDescription description, DataContractFormatAttribute dataContractFormatAttribute, DataContractSerializerOperationBehavior serializerFactory) { this.MessageCompressor = new MessageCompressor(algorithm); Type innerFormatterType = Type.GetType(DataContractSerializerOperationFormatterTypeName); var innerFormatter = Activator.CreateInstance(innerFormatterType, description, dataContractFormatAttribute, serializerFactory); this.InnerClientMessageFormatter = innerFormatter as IClientMessageFormatter; this.InnerDispatchMessageFormatter = innerFormatter as IDispatchMessageFormatter; }
public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) { dispatchOperation.SerializeReply = true; dispatchOperation.DeserializeRequest = true; var dataContractFormatAttribute = operationDescription.SyncMethod.GetCustomAttributes(typeof(DataContractFormatAttribute), true).FirstOrDefault() as DataContractFormatAttribute; if (null == dataContractFormatAttribute) { dataContractFormatAttribute = new DataContractFormatAttribute(); } var dataContractSerializerOperationBehavior = operationDescription.Behaviors.Find<DataContractSerializerOperationBehavior>(); dispatchOperation.Formatter = new CompressionMessageFormatter(this.Algorithm, operationDescription, dataContractFormatAttribute, dataContractSerializerOperationBehavior); }
public static TypedMessageConverter Create(Type messageContract, String action, String defaultNamespace, DataContractFormatAttribute formatterAttribute) { if (messageContract == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("messageContract")); if (!messageContract.IsDefined(typeof(MessageContractAttribute), false)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.SFxMessageContractAttributeRequired, messageContract), "messageContract")); if (defaultNamespace == null) defaultNamespace = NamingHelper.DefaultNamespace; return new XmlMessageConverter(GetOperationFormatter(messageContract, formatterAttribute, defaultNamespace, action)); }
public static TypedMessageConverter Create(System.Type messageContract, string action, string defaultNamespace, DataContractFormatAttribute formatterAttribute) { if (messageContract == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("messageContract")); } if (!messageContract.IsDefined(typeof(MessageContractAttribute), false)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("SFxMessageContractAttributeRequired", new object[] { messageContract }), "messageContract")); } if (defaultNamespace == null) { defaultNamespace = "http://tempuri.org/"; } return new XmlMessageConverter(GetOperationFormatter(messageContract, formatterAttribute, defaultNamespace, action)); }
public DataContractMessagesFormatter (OperationDescription desc, DataContractFormatAttribute attr) : base (desc) { this.attr = attr; }
internal DataContractSerializerOperationBehavior(OperationDescription operation, DataContractFormatAttribute dataContractFormatAttribute, bool builtInOperationBehavior) : this(operation, dataContractFormatAttribute) { this.builtInOperationBehavior = builtInOperationBehavior; }
public DataContractSerializerOperationBehavior(OperationDescription operation, DataContractFormatAttribute dataContractFormatAttribute) { this.dataContractFormatAttribute = dataContractFormatAttribute ?? new DataContractFormatAttribute(); this.operation = operation; }
public DataContractMessagesFormatter (OperationDescription desc, DataContractFormatAttribute attr) : base (desc) { #if !NET_2_1 this.serializerBehavior = desc.Behaviors.Find<DataContractSerializerOperationBehavior>(); #endif this.attr = attr; }
public EfDataContractSerializerAttribute(OperationDescription operation, DataContractFormatAttribute dataContractFormatAttribute) { _innerOperationBehavior = new EfDataContractSerializerOperationBehavior(operation, dataContractFormatAttribute); }
private MessageInfo CreateMessageInfo(DataContractFormatAttribute dataContractFormatAttribute, MessageDescription messageDescription, DataContractSerializerOperationBehavior serializerFactory) { if (messageDescription.IsUntypedMessage) { return null; } MessageInfo info = new MessageInfo(); MessageBodyDescription body = messageDescription.Body; if (body.WrapperName != null) { info.WrapperName = base.AddToDictionary(body.WrapperName); info.WrapperNamespace = base.AddToDictionary(body.WrapperNamespace); } MessagePartDescriptionCollection parts = body.Parts; info.BodyParts = new PartInfo[parts.Count]; for (int i = 0; i < parts.Count; i++) { info.BodyParts[i] = this.CreatePartInfo(parts[i], dataContractFormatAttribute.Style, serializerFactory); } if (OperationFormatter.IsValidReturnValue(messageDescription.Body.ReturnValue)) { info.ReturnPart = this.CreatePartInfo(messageDescription.Body.ReturnValue, dataContractFormatAttribute.Style, serializerFactory); } info.HeaderDescriptionTable = new OperationFormatter.MessageHeaderDescriptionTable(); info.HeaderParts = new PartInfo[messageDescription.Headers.Count]; for (int j = 0; j < messageDescription.Headers.Count; j++) { MessageHeaderDescription message = messageDescription.Headers[j]; if (message.IsUnknownHeaderCollection) { info.UnknownHeaderDescription = message; } else { this.ValidateDataContractType(message.Type); info.HeaderDescriptionTable.Add(message.Name, message.Namespace, message); } info.HeaderParts[j] = this.CreatePartInfo(message, OperationFormatStyle.Document, serializerFactory); } info.AnyHeaders = (info.UnknownHeaderDescription != null) || (info.HeaderDescriptionTable.Count > 0); return info; }
public DataContractSerializerOperationBehavior(OperationDescription operation, System.ServiceModel.DataContractFormatAttribute dataContractFormatAttribute) { this.maxItemsInObjectGraph = 0x10000; this.dataContractFormatAttribute = dataContractFormatAttribute ?? new System.ServiceModel.DataContractFormatAttribute(); this.operation = operation; }
public DataContractMessagesFormatter (MessageDescriptionCollection messages, DataContractFormatAttribute attr) : base (messages) { this.attr = attr; }
/// <summary> /// Create new instance of object. /// </summary> /// <param name="operation">Operation description.</param> /// <param name="dataContractFormatAttribute">Data contract attribute object.</param> public NetDataContractOperationBehavior(OperationDescription operation, DataContractFormatAttribute dataContractFormatAttribute) : base(operation, dataContractFormatAttribute) { }
public static TypedMessageConverter Create(Type messageContract, string action, DataContractFormatAttribute formatterAttribute) { return Create(messageContract, action, null, formatterAttribute); }
public static TypedMessageConverter Create ( Type type, string action, string defaultNamespace, DataContractFormatAttribute formatterAttribute) { return new DefaultTypedMessageConverter ( new DataContractMessagesFormatter ( MessageContractToMessagesDescription (type, defaultNamespace, action), formatterAttribute)); }
public static TypedMessageConverter Create ( Type type, string action, DataContractFormatAttribute formatterAttribute) { return Create (type, action, TempUri, formatterAttribute); }
public DataContractSerializerOperationFormatter(OperationDescription description, DataContractFormatAttribute dataContractFormatAttribute, DataContractSerializerOperationBehavior serializerFactory) : base(description, dataContractFormatAttribute.Style == OperationFormatStyle.Rpc, false/*isEncoded*/) { if (description == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description"); this.serializerFactory = serializerFactory ?? new DataContractSerializerOperationBehavior(description); foreach (Type type in description.KnownTypes) { if (knownTypes == null) knownTypes = new List<Type>(); if (type == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxKnownTypeNull, description.Name))); ValidateDataContractType(type); knownTypes.Add(type); } requestMessageInfo = CreateMessageInfo(dataContractFormatAttribute, RequestDescription, this.serializerFactory); if (ReplyDescription != null) replyMessageInfo = CreateMessageInfo(dataContractFormatAttribute, ReplyDescription, this.serializerFactory); }
MessageInfo CreateMessageInfo(DataContractFormatAttribute dataContractFormatAttribute, MessageDescription messageDescription, DataContractSerializerOperationBehavior serializerFactory) { if (messageDescription.IsUntypedMessage) return null; MessageInfo messageInfo = new MessageInfo(); MessageBodyDescription body = messageDescription.Body; if (body.WrapperName != null) { messageInfo.WrapperName = AddToDictionary(body.WrapperName); messageInfo.WrapperNamespace = AddToDictionary(body.WrapperNamespace); } MessagePartDescriptionCollection parts = body.Parts; messageInfo.BodyParts = new PartInfo[parts.Count]; for (int i = 0; i < parts.Count; i++) messageInfo.BodyParts[i] = CreatePartInfo(parts[i], dataContractFormatAttribute.Style, serializerFactory); if (IsValidReturnValue(messageDescription.Body.ReturnValue)) messageInfo.ReturnPart = CreatePartInfo(messageDescription.Body.ReturnValue, dataContractFormatAttribute.Style, serializerFactory); messageInfo.HeaderDescriptionTable = new MessageHeaderDescriptionTable(); messageInfo.HeaderParts = new PartInfo[messageDescription.Headers.Count]; for (int i = 0; i < messageDescription.Headers.Count; i++) { MessageHeaderDescription headerDescription = messageDescription.Headers[i]; if (headerDescription.IsUnknownHeaderCollection) messageInfo.UnknownHeaderDescription = headerDescription; else { ValidateDataContractType(headerDescription.Type); messageInfo.HeaderDescriptionTable.Add(headerDescription.Name, headerDescription.Namespace, headerDescription); } messageInfo.HeaderParts[i] = CreatePartInfo(headerDescription, OperationFormatStyle.Document, serializerFactory); } messageInfo.AnyHeaders = messageInfo.UnknownHeaderDescription != null || messageInfo.HeaderDescriptionTable.Count > 0; return messageInfo; }
public EfDataContractSerializerOperationBehavior(OperationDescription operation, DataContractFormatAttribute dataContractFormatAttribute) : base(operation, dataContractFormatAttribute) { }
internal ExtensionData(DataContractFormatAttribute dcFormatAttr) { this.dcFormatAttr = dcFormatAttr; }
internal DataContractSerializerOperationBehavior(OperationDescription operation, System.ServiceModel.DataContractFormatAttribute dataContractFormatAttribute, bool builtInOperationBehavior) : this(operation, dataContractFormatAttribute) { this.builtInOperationBehavior = builtInOperationBehavior; }