• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDataContractSurrogate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SurrogateToDataContractType

 internal static object SurrogateToDataContractType(IDataContractSurrogate dataContractSurrogate, object oldObj, Type surrogatedDeclaredType, ref Type objType)
 {
     object obj = DataContractSurrogateCaller.GetObjectToSerialize(dataContractSurrogate, oldObj, objType, surrogatedDeclaredType);
     if (obj != oldObj)
     {
         if (obj == null)
             objType = Globals.TypeOfObject;
         else
             objType = obj.GetType();
     }
     return obj;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:DataContractSerializer.cs


示例17: Initialize

 void Initialize(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace,
     IEnumerable<Type> knownTypes,
     int maxItemsInObjectGraph,
     bool ignoreExtensionDataObject,
     bool preserveObjectReferences,
     IDataContractSurrogate dataContractSurrogate,
     DataContractResolver dataContractResolver,
     bool serializeReadOnlyTypes)
 {
     Initialize(type, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, preserveObjectReferences, dataContractSurrogate, dataContractResolver, serializeReadOnlyTypes);
     // validate root name and namespace are both non-null
     this.rootName = rootName;
     this.rootNamespace = rootNamespace;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:DataContractSerializer.cs


示例18: DataContractJsonSerializer

 public DataContractJsonSerializer(Type type, XmlDictionaryString rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
 {
     this.Initialize(type, rootName, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, alwaysEmitTypeInformation);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:DataContractJsonSerializer.cs


示例19: Initialize

		void Initialize (
			int maxObjectsInGraph,
			bool ignoreExtensionDataObject,
			bool preserveObjectReferences,
			IDataContractSurrogate dataContractSurrogate)
		{
			if (maxObjectsInGraph < 0)
				throw new ArgumentOutOfRangeException ("maxObjectsInGraph must not be negative.");
			max_items = maxObjectsInGraph;
			ignore_ext = ignoreExtensionDataObject;
			preserve_refs = preserveObjectReferences;
			surrogate = dataContractSurrogate;
		}
开发者ID:ngraziano,项目名称:mono,代码行数:13,代码来源:DataContractSerializer.cs


示例20: DataContractJsonSerializer

		public DataContractJsonSerializer (Type type, string rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
			: this (type, rootName, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, alwaysEmitTypeInformation)
		{
			surrogate = dataContractSurrogate;
		}
开发者ID:GirlD,项目名称:mono,代码行数:5,代码来源:DataContractJsonSerializer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDataDescriptor类代码示例发布时间:2022-05-24
下一篇:
C# IDataContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap