当前位置: 首页>>代码示例>>C#>>正文


C# IDataContractSurrogate类代码示例

本文整理汇总了C#中IDataContractSurrogate的典型用法代码示例。如果您正苦于以下问题:C# IDataContractSurrogate类的具体用法?C# IDataContractSurrogate怎么用?C# IDataContractSurrogate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IDataContractSurrogate类属于命名空间,在下文中一共展示了IDataContractSurrogate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataContractJsonSerializerOperationBehavior

 public DataContractJsonSerializerOperationBehavior(OperationDescription description, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
     : base(description)
 {
     this.MaxItemsInObjectGraph = maxItemsInObjectGraph;
     this.IgnoreExtensionDataObject = ignoreExtensionDataObject;
     this.DataContractSurrogate = dataContractSurrogate;
     this.alwaysEmitTypeInformation = alwaysEmitTypeInformation;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:DataContractJsonSerializerOperationBehavior.cs

示例2: GetCustomDataToExport

 internal static object GetCustomDataToExport(IDataContractSurrogate surrogate, Type clrType, Type dataContractType)
 {
     if (DataContract.GetBuiltInDataContract(clrType) != null)
     {
         return null;
     }
     return surrogate.GetCustomDataToExport(clrType, dataContractType);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DataContractSurrogateCaller.cs

示例3: GetDeserializedObject

 internal static object GetDeserializedObject(IDataContractSurrogate surrogate, object obj, Type objType, Type memberType)
 {
     if (obj == null)
         return null;
     if (DataContract.GetBuiltInDataContract(objType) != null)
         return obj;
     return surrogate.GetDeserializedObject(obj, memberType);
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:8,代码来源:IDataContractSurrogate.cs

示例4: GetReferencedTypeOnImport

 internal static Type GetReferencedTypeOnImport(IDataContractSurrogate surrogate, string typeName, string typeNamespace, object customData)
 {
     if (DataContract.GetBuiltInDataContract(typeName, typeNamespace) != null)
     {
         return null;
     }
     return surrogate.GetReferencedTypeOnImport(typeName, typeNamespace, customData);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DataContractSurrogateCaller.cs

示例5: GetDataContractType

 internal static Type GetDataContractType(IDataContractSurrogate surrogate, Type type)
 {
     if (DataContract.GetBuiltInDataContract(type) != null)
         return type;
     Type dcType = surrogate.GetDataContractType(type);
     if (dcType == null)
         return type;
     return dcType;
 }
开发者ID:nuxleus,项目名称:WCFWeb,代码行数:9,代码来源:IDataContractSurrogate.cs

示例6: DataContractSerializer

 public DataContractSerializer(Type type, string rootName, string rootNamespace,
     IEnumerable<Type> knownTypes,
     int maxItemsInObjectGraph,
     bool ignoreExtensionDataObject,
     bool preserveObjectReferences,
     IDataContractSurrogate dataContractSurrogate)
     : this(type, rootName, rootNamespace, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, preserveObjectReferences, dataContractSurrogate, null)
 {
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:DataContractSerializer.cs

示例7: DataContractJsonSerializer

 public DataContractJsonSerializer(Type type,
     IEnumerable<Type> knownTypes,
     int maxItemsInObjectGraph,
     bool ignoreExtensionDataObject,
     IDataContractSurrogate dataContractSurrogate,
     bool alwaysEmitTypeInformation)
 {
     EmitTypeInformation emitTypeInformation = alwaysEmitTypeInformation ? EmitTypeInformation.Always : EmitTypeInformation.AsNeeded;
     Initialize(type, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, emitTypeInformation, false, null, false);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:10,代码来源:DataContractJsonSerializer.cs

示例8: GetObjectToSerialize

 internal static object GetObjectToSerialize(IDataContractSurrogate surrogate, object obj, Type objType, Type membertype)
 {
     if (obj == null)
     {
         return null;
     }
     if (DataContract.GetBuiltInDataContract(objType) != null)
     {
         return obj;
     }
     return surrogate.GetObjectToSerialize(obj, membertype);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:DataContractSurrogateCaller.cs

示例9: Deserialize

		public static object Deserialize (XmlReader reader, Type declaredType,
			KnownTypeCollection knownTypes, IDataContractSurrogate surrogate, DataContractResolver resolver, DataContractResolver defaultResolver,
			string name, string ns, bool verifyObjectName)
		{
			reader.MoveToContent ();
			if (verifyObjectName)
				if (reader.NodeType != XmlNodeType.Element ||
				    reader.LocalName != name ||
				    reader.NamespaceURI != ns)
					throw new SerializationException (String.Format ("Expected element '{0}' in namespace '{1}', but found {2} node '{3}' in namespace '{4}'", name, ns, reader.NodeType, reader.LocalName, reader.NamespaceURI));
//				Verify (knownTypes, declaredType, name, ns, reader);
			return new XmlFormatterDeserializer (knownTypes, surrogate, resolver, defaultResolver).Deserialize (declaredType, reader);
		}
开发者ID:nestalk,项目名称:mono,代码行数:13,代码来源:XmlFormatterDeserializer.cs

示例10: AddDataContractSurrogate

 public static void AddDataContractSurrogate(this ServiceHostBase host, IDataContractSurrogate surrogate)
 {
     foreach (var endpoint in host.Description.Endpoints)
     {
         foreach (var operation in endpoint.Contract.Operations)
         {
             var dc = operation.Behaviors.Find<DataContractSerializerOperationBehavior>();
             if (dc != null)
             {
                 dc.DataContractSurrogate = surrogate;
             }
         }
     }
     var exporter = host.GetXsdDataContractExporter();
     if (exporter != null)
     {
         exporter.Options.DataContractSurrogate = surrogate;
     }
 }
开发者ID:alexdej,项目名称:wcfextras,代码行数:19,代码来源:Serialization.cs

示例11: ConfigureOperationDescriptionBehaviors

 private void ConfigureOperationDescriptionBehaviors(OperationDescription operation, IDataContractSurrogate contractSurrogate)
 {
     DataContractSerializerOperationBehavior item = new DataContractSerializerOperationBehavior(operation, TypeLoader.DefaultDataContractFormatAttribute);
     if (contractSurrogate != null)
     {
         item.DataContractSurrogate = contractSurrogate;
     }
     operation.Behaviors.Add(item);
     operation.Behaviors.Add(new OperationInvokerBehavior());
     if ((this.info.TransactionOption == TransactionOption.Supported) || (this.info.TransactionOption == TransactionOption.Required))
     {
         operation.Behaviors.Add(new TransactionFlowAttribute(TransactionFlowOption.Allowed));
     }
     OperationBehaviorAttribute attribute = new OperationBehaviorAttribute {
         TransactionAutoComplete = true,
         TransactionScopeRequired = false
     };
     operation.Behaviors.Add(attribute);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:ComPlusTypeLoader.cs

示例12: DataContractSurrogateBehavior

		public DataContractSurrogateBehavior(Type surrogateType)
		{
			if (typeof(IDataContractSurrogate).IsAssignableFrom(surrogateType) == false)
			{
				throw new ArgumentException(string.Format(
					"The data contract surrogate {0} does not implement {1}.",
					surrogateType.FullName,
					typeof(IDataContractSurrogate).FullName),
					"surrogateType");
			}

			var surrogateCtor = surrogateType.GetConstructor(Type.EmptyTypes);
			if (surrogateCtor == null)
			{
				throw new ArgumentException(string.Format(
					"The data contract surrogate {0} does not have an empty public constructor.",
					surrogateType.FullName));
			}

			surrogate = (IDataContractSurrogate)surrogateCtor.Invoke(new object[0]);
		}
开发者ID:dohansen,项目名称:Windsor,代码行数:21,代码来源:DataContractSurrogateBehavior.cs

示例13: DataContractSerializer

		public DataContractSerializer (Type type,
			IEnumerable<Type> knownTypes,
			int maxObjectsInGraph,
			bool ignoreExtensionDataObject,
			bool preserveObjectReferences,
			IDataContractSurrogate dataContractSurrogate)
			: this (type, knownTypes)
		{
			Initialize (maxObjectsInGraph,
				ignoreExtensionDataObject,
				preserveObjectReferences,
				dataContractSurrogate);
		}
开发者ID:ngraziano,项目名称:mono,代码行数:13,代码来源:DataContractSerializer.cs

示例14: GetSurrogatedType

 internal static Type GetSurrogatedType(IDataContractSurrogate dataContractSurrogate, Type type)
 {
     return DataContractSurrogateCaller.GetDataContractType(dataContractSurrogate, DataContract.UnwrapNullableType(type));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:DataContractSerializer.cs

示例15: Initialize

 private void Initialize(Type type, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
 {
     XmlObjectSerializer.CheckNull(type, "type");
     this.rootType = type;
     if (knownTypes != null)
     {
         this.knownTypeList = new List<Type>();
         foreach (Type type2 in knownTypes)
         {
             this.knownTypeList.Add(type2);
             if (type2 != null)
             {
                 this.AddCollectionItemTypeToKnownTypes(type2);
             }
         }
     }
     if (maxItemsInObjectGraph < 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxItemsInObjectGraph", System.Runtime.Serialization.SR.GetString("ValueMustBeNonNegative")));
     }
     this.maxItemsInObjectGraph = maxItemsInObjectGraph;
     this.ignoreExtensionDataObject = ignoreExtensionDataObject;
     this.dataContractSurrogate = dataContractSurrogate;
     this.alwaysEmitTypeInformation = alwaysEmitTypeInformation;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:DataContractJsonSerializer.cs


注:本文中的IDataContractSurrogate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。