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

C# IObjectDescriptor类代码示例

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

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



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

示例1: Enter

        public override bool Enter(IObjectDescriptor value, IEmitter context)
        {
            var typeConverter = typeConverters.FirstOrDefault(t => t.Accepts(value.Type));
            if (typeConverter != null)
            {
                typeConverter.WriteYaml(context, value.Value, value.Type);
                return false;
            }

            var convertible = value.Value as IYamlConvertible;
            if (convertible != null)
            {
                convertible.Write(context, nestedObjectSerializer);
                return false;
            }

            #pragma warning disable 0618 // IYamlSerializable is obsolete
            var serializable = value.Value as IYamlSerializable;
            if (serializable != null)
            {
                serializable.WriteYaml(context);
                return false;
            }
            #pragma warning restore

            return base.Enter(value, context);
        }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:27,代码来源:CustomSerializationObjectGraphVisitor.cs


示例2: TraverseProperties

        protected override void TraverseProperties(IObjectDescriptor value, IObjectGraphVisitor visitor, int currentDepth)
        {
            if (!ReflectionUtility.HasDefaultConstructor(value.Type) && !serializer.Converters.Any(c => c.Accepts(value.Type)))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Type '{0}' cannot be deserialized because it does not have a default constructor or a type converter.", value.Type));
            }

            base.TraverseProperties(value, visitor, currentDepth);
        }
开发者ID:kitsilanosoftware,项目名称:YamlDotNet,代码行数:9,代码来源:RoundtripObjectGraphTraversalStrategy.cs


示例3: EnterMapping

		public override bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor value)
		{
			var defaultValueAttribute = key.GetCustomAttribute<DefaultValueAttribute>();
			var defaultValue = defaultValueAttribute != null
				? defaultValueAttribute.Value
				: GetDefault(key.Type);

			return !_objectComparer.Equals(value.Value, defaultValue)
				   && base.EnterMapping(key, value);
		}
开发者ID:danieldeb,项目名称:EventStore,代码行数:10,代码来源:DefaultExclusiveObjectGraphVisitor.cs


示例4: Enter

		public override bool Enter(IObjectDescriptor value)
		{
			var alias = aliasProvider.GetAlias(value.Value);
			if (alias != null && !emittedAliases.Add(alias))
			{
				eventEmitter.Emit(new AliasEventInfo(value) { Alias = alias });
				return false;
			}

			return base.Enter(value);
		}
开发者ID:ActivePHOENiX,项目名称:YamlDotNet,代码行数:11,代码来源:AnchorAssigningObjectGraphVisitor.cs


示例5: EmitDocument

        private void EmitDocument(IEmitter emitter, IObjectDescriptor graph)
        {
            var traversalStrategy = CreateTraversalStrategy();
            var eventEmitter = CreateEventEmitter(emitter);
            var emittingVisitor = CreateEmittingVisitor(emitter, traversalStrategy, eventEmitter, graph);

            emitter.Emit(new StreamStart());
            emitter.Emit(new DocumentStart());

            traversalStrategy.Traverse(graph, emittingVisitor);

            emitter.Emit(new DocumentEnd(true));
            emitter.Emit(new StreamEnd());
        }
开发者ID:vwxyzh,项目名称:Zhenway.YamlSerializations,代码行数:14,代码来源:YamlSerializer.cs


示例6: Enter

        protected override bool Enter(IObjectDescriptor value)
        {
            AnchorAssignment assignment;
            if (value.Value != null && assignments.TryGetValue(value.Value, out assignment))
            {
                if (assignment.Anchor == null)
                {
                    assignment.Anchor = "o" + nextId.ToString(CultureInfo.InvariantCulture);
                    ++nextId;
                }
                return false;
            }

            return true;
        }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:15,代码来源:AnchorAssigner.cs


示例7: Enter

		public override bool Enter(IObjectDescriptor value)
		{
			var typeConverter = typeConverters.FirstOrDefault(t => t.Accepts(value.Type));
			if (typeConverter != null)
			{
				typeConverter.WriteYaml(emitter, value.Value, value.Type);
				return false;
			}

			var serializable = value as IYamlSerializable;
			if (serializable != null)
			{
				serializable.WriteYaml(emitter);
				return false;
			}

			return base.Enter(value);
		}
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:18,代码来源:CustomSerializationObjectGraphVisitor.cs


示例8: CreateEmittingVisitor

        private IObjectGraphVisitor CreateEmittingVisitor(IEmitter emitter, IObjectGraphTraversalStrategy traversalStrategy, IEventEmitter eventEmitter, IObjectDescriptor graph)
        {
            IObjectGraphVisitor emittingVisitor = new EmittingObjectGraphVisitor(eventEmitter);

            emittingVisitor = new CustomSerializationObjectGraphVisitor(emitter, emittingVisitor, Converters);

            if (!IsOptionSet(SerializationOptions.DisableAliases))
            {
                var anchorAssigner = new AnchorAssigner();
                traversalStrategy.Traverse(graph, anchorAssigner);

                emittingVisitor = new AnchorAssigningObjectGraphVisitor(emittingVisitor, eventEmitter, anchorAssigner);
            }

            if (!IsOptionSet(SerializationOptions.EmitDefaults))
            {
                emittingVisitor = new DefaultExclusiveObjectGraphVisitor(emittingVisitor);
            }

            return emittingVisitor;
        }
开发者ID:vwxyzh,项目名称:Zhenway.YamlSerializations,代码行数:21,代码来源:YamlSerializer.cs


示例9: AnchorAssignment

        bool IObjectGraphVisitor.Enter(IObjectDescriptor value)
        {
            // Do not assign anchors to basic types
            if (value.Value == null || value.Type.GetTypeCode() != TypeCode.Object)
            {
                return false;
            }

            AnchorAssignment assignment;
            if (assignments.TryGetValue(value.Value, out assignment))
            {
                if (assignment.Anchor == null)
                {
                    assignment.Anchor = "o" + nextId.ToString(CultureInfo.InvariantCulture);
                    ++nextId;
                }
                return false;
            }
            else
            {
                assignments.Add(value.Value, new AnchorAssignment());
                return true;
            }
        }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:24,代码来源:AnchorAssigner.cs


示例10:

		bool IObjectGraphVisitor.EnterMapping(IPropertyDescriptor key, IObjectDescriptor value)
		{
			return true;
		}
开发者ID:adbrowne,项目名称:EventStore,代码行数:4,代码来源:EmittingObjectGraphVisitor.cs


示例11: VisitMappingStart

 public virtual void VisitMappingStart(IObjectDescriptor mapping, Type keyType, Type valueType)
 {
     nextVisitor.VisitMappingStart(mapping, keyType, valueType);
 }
开发者ID:kitsilanosoftware,项目名称:YamlDotNet,代码行数:4,代码来源:ChainedObjectGraphVisitor.cs


示例12: VisitSequenceEnd

 public virtual void VisitSequenceEnd(IObjectDescriptor sequence)
 {
     nextVisitor.VisitSequenceEnd(sequence);
 }
开发者ID:kitsilanosoftware,项目名称:YamlDotNet,代码行数:4,代码来源:ChainedObjectGraphVisitor.cs


示例13: VisitScalar

		public override void VisitScalar(IObjectDescriptor scalar)
		{
			eventEmitter.Emit(new ScalarEventInfo(scalar) { Anchor = aliasProvider.GetAlias(scalar.Value) });
		}
开发者ID:ActivePHOENiX,项目名称:YamlDotNet,代码行数:4,代码来源:AnchorAssigningObjectGraphVisitor.cs


示例14: EnterMapping

 public virtual bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor value)
 {
     return nextVisitor.EnterMapping(key, value);
 }
开发者ID:kitsilanosoftware,项目名称:YamlDotNet,代码行数:4,代码来源:ChainedObjectGraphVisitor.cs


示例15: VisitMappingStart

		public override void VisitMappingStart(IObjectDescriptor mapping, Type keyType, Type valueType)
		{
			eventEmitter.Emit(new MappingStartEventInfo(mapping) { Anchor = aliasProvider.GetAlias(mapping.Value) });
		}
开发者ID:ActivePHOENiX,项目名称:YamlDotNet,代码行数:4,代码来源:AnchorAssigningObjectGraphVisitor.cs


示例16: SequenceStartEventInfo

		public SequenceStartEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
开发者ID:czcz1024,项目名称:EventStore,代码行数:4,代码来源:EventInfo.cs


示例17: MappingEndEventInfo

		public MappingEndEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
开发者ID:czcz1024,项目名称:EventStore,代码行数:4,代码来源:EventInfo.cs


示例18: ScalarEventInfo

		public ScalarEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
开发者ID:czcz1024,项目名称:EventStore,代码行数:4,代码来源:EventInfo.cs


示例19: VisitSequenceStart

		public override void VisitSequenceStart(IObjectDescriptor sequence, Type elementType)
		{
			eventEmitter.Emit(new SequenceStartEventInfo(sequence) { Anchor = aliasProvider.GetAlias(sequence.Value) });
		}
开发者ID:ActivePHOENiX,项目名称:YamlDotNet,代码行数:4,代码来源:AnchorAssigningObjectGraphVisitor.cs


示例20: ScalarEventInfo

		void IObjectGraphVisitor.VisitScalar(IObjectDescriptor scalar)
		{
			eventEmitter.Emit(new ScalarEventInfo(scalar));
		}
开发者ID:adbrowne,项目名称:EventStore,代码行数:4,代码来源:EmittingObjectGraphVisitor.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IObjectFacade类代码示例发布时间:2022-05-24
下一篇:
C# IObjectDefinition类代码示例发布时间: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