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


C# BsonWriter.WriteString方法代码示例

本文整理汇总了C#中MongoDB.Bson.IO.BsonWriter.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# BsonWriter.WriteString方法的具体用法?C# BsonWriter.WriteString怎么用?C# BsonWriter.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB.Bson.IO.BsonWriter的用法示例。


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

示例1: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
                throw new PBException("serialize OXmlSimpleFieldElement value is null");
            if (_trace)
                pb.Trace.WriteLine("OXmlSimpleFieldElementSerializer.Serialize()");

            OXmlSimpleFieldElement element = (OXmlSimpleFieldElement)value;
            bsonWriter.WriteStartDocument();
            bsonWriter.WriteString("Type", "SimpleField");
            bsonWriter.WriteString("Instruction", element.Instruction);
            bsonWriter.WriteEndDocument();
        }
开发者ID:labeuze,项目名称:source,代码行数:13,代码来源:OXmlSimpleFieldElementSerializer.cs

示例2: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
                throw new PBException("serialize OXmlOpenHeader value is null");
            if (_trace)
                pb.Trace.WriteLine("OXmlOpenHeaderElementSerializer.Serialize()");

            OXmlOpenHeaderElement element = (OXmlOpenHeaderElement)value;
            bsonWriter.WriteStartDocument();
            bsonWriter.WriteString("Type", "OpenHeader");
            bsonWriter.WriteString("HeaderType", element.HeaderType.ToString());
            bsonWriter.WriteEndDocument();
        }
开发者ID:labeuze,项目名称:source,代码行数:13,代码来源:OXmlOpenHeaderElementSerializer.cs

示例3: Serialize

        public void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            var method = (MethodInfo)value;

            bsonWriter.WriteStartDocument();
            bsonWriter.WriteName("Type");
            bsonWriter.WriteString(method.DeclaringType.AssemblyQualifiedName);
            bsonWriter.WriteName("Method");
            bsonWriter.WriteString(GetMethodSignature(method));

            bsonWriter.WriteEndDocument();

        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:13,代码来源:MethodInfoSerializer.cs

示例4: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
                throw new PBException("serialize OXmlParagraphElement value is null");
            if (_trace)
                pb.Trace.WriteLine("OXmlParagraphElementSerializer.Serialize()");

            OXmlParagraphElement paragraph = (OXmlParagraphElement)value;
            bsonWriter.WriteStartDocument();
            bsonWriter.WriteString("Type", "Paragraph");
            if (paragraph.Style != null)
                bsonWriter.WriteString("Style", paragraph.Style);
            bsonWriter.WriteEndDocument();
        }
开发者ID:labeuze,项目名称:source,代码行数:14,代码来源:OXmlParagraphElementSerializer.cs

示例5: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
                throw new PBException("serialize OXmlTextElement value is null");
            if (_trace)
                pb.Trace.WriteLine("OXmlTextElementSerializer.Serialize()");

            OXmlTextElement element = (OXmlTextElement)value;
            bsonWriter.WriteStartDocument();
            bsonWriter.WriteString("Type", "Text");
            if (element.Text != null)
                bsonWriter.WriteString("Text", element.Text);
            if (element.PreserveSpace)
                bsonWriter.WriteBoolean("PreserveSpace", element.PreserveSpace);
            bsonWriter.WriteEndDocument();
        }
开发者ID:labeuze,项目名称:source,代码行数:16,代码来源:OXmlTextElementSerializer.cs

示例6: Serialize

 public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
 {
     var c = (C)value;
     bsonWriter.WriteStartDocument();
     bsonWriter.WriteString("nominalType", nominalType.Name);
     bsonWriter.WriteInt32("X", c.X);
     bsonWriter.WriteEndDocument();
 }
开发者ID:rakesh-elevate,项目名称:mongo-csharp-driver,代码行数:8,代码来源:BsonDocumentWrapperTests.cs

示例7: Serialize

 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     IBsonSerializationOptions options
 ) {
     var dateTime = (DateTime) value;
     bsonWriter.WriteString(dateTime.ToString("yyyy-MM-dd"));
 }
开发者ID:kamiff,项目名称:mongo-csharp-driver,代码行数:9,代码来源:BsonDefaultSerializerTests.cs

示例8: Serialize

        public override void Serialize(
			BsonWriter bsonWriter,
			Type nominalType,
			object value,
			IBsonSerializationOptions options
			)
        {
            var type = (Type)value;
            bsonWriter.WriteString(type.AssemblyQualifiedName);
        }
开发者ID:CaptainCodeman,项目名称:quartznet,代码行数:10,代码来源:TypeSerializer.cs

示例9: Serialize

 public override void Serialize(BsonWriter bsonWriter, Type nominalType,
     object value, IBsonSerializationOptions options)
 {
     if (value != null)
     {
         bsonWriter.WriteString(value.ToString());
     }
     else
     {
         bsonWriter.WriteNull();
     }
 }
开发者ID:neoms21,项目名称:FeelKnit.Service,代码行数:12,代码来源:StringOrGuidSerializer.cs

示例10: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
            {
                bsonWriter.WriteNull();
            }
            else
            {
                var crs = (GeoJsonLinkedCoordinateReferenceSystem)value;

                bsonWriter.WriteStartDocument();
                SerializeType(bsonWriter, crs.Type);
                bsonWriter.WriteStartDocument("properties");
                bsonWriter.WriteString("href", crs.HRef);
                if (crs.HRefType != null)
                {
                    bsonWriter.WriteString("type", crs.HRefType);
                }
                bsonWriter.WriteEndDocument();
                bsonWriter.WriteEndDocument();
            }
        }
开发者ID:pwelter34,项目名称:mongo-csharp-driver,代码行数:22,代码来源:GeoJsonLinkedCoordinateReferenceSystemSerializer.cs

示例11: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            // when entry is null, do not throw, just write null
            if (value == null)
            {
                bsonWriter.WriteNull();
                return;
            }

            if (_failOnSerialize)
                throw new InvalidOperationException();

            bsonWriter.WriteString((string)value);
        }
开发者ID:hitesh97,项目名称:fluent-mongo,代码行数:14,代码来源:FailingStringSerializer.cs

示例12: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
            {
                throw new PBException("error serialize UrlImage value is null");
            }

            //bsonWriter.WriteString(((WebImage)value).Url);
            string url = ((WebImage)value).Url;
            if (url != null)
                bsonWriter.WriteString(url);
            else
                bsonWriter.WriteNull();
        }
开发者ID:labeuze,项目名称:source,代码行数:14,代码来源:UrlImageSerializer.cs

示例13: Serialize

 public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
 {
     var identity = (Identity)value;
     var objectId = new ObjectId(identity.ToArray());
     BsonType bsonType = options == null ? BsonType.ObjectId : ((RepresentationSerializationOptions)options).Representation;
     switch (bsonType)
     {
         case BsonType.String:
             bsonWriter.WriteString(objectId.ToString());
             break;
         case BsonType.ObjectId:
             bsonWriter.WriteObjectId(objectId.Timestamp, objectId.Machine, objectId.Pid, objectId.Increment);
             break;
         default:
             throw new BsonSerializationException(string.Format("'{0}' is not a valid representation for type 'Identity'", bsonType));
     }
 }
开发者ID:wook815,项目名称:Hermes,代码行数:17,代码来源:IdentitySerializer.cs

示例14: Serialize

        public override void Serialize(
			BsonWriter bsonWriter,
			Type nominalType,
			object value,
			IBsonSerializationOptions options
			)
        {
            var nvc = (NameValueCollection)value;
            bsonWriter.WriteStartDocument();
            if (nvc != null && nvc.Count > 0)
            {
                foreach (var key in nvc.AllKeys)
                {
                    bsonWriter.WriteString(key.Replace(".", "__period__"), nvc[key]);
                }
            }
            bsonWriter.WriteEndDocument();
        }
开发者ID:JefClaes,项目名称:elmah-mongodb,代码行数:18,代码来源:NameValueCollectionSerializer.cs

示例15: Serialize

        /// <summary>
        /// Serializes an object to a BsonWriter.
        /// </summary>
        /// <param name="bsonWriter">The BsonWriter.</param>
        /// <param name="nominalType">The nominal type.</param>
        /// <param name="value">The object.</param>
        /// <param name="options">The serialization options.</param>
        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (_trace)
                pb.Trace.WriteLine("ZStringSerializer.Serialize()");

            if (value == null)
            {
                //throw new ArgumentNullException("value");
                throw new PBException("error serialize ZString value is null");
            }

            string stringValue = ((ZString)value).Value;

            if (stringValue == null)
                bsonWriter.WriteNull();
            else
                bsonWriter.WriteString(stringValue);
        }
开发者ID:labeuze,项目名称:source,代码行数:25,代码来源:ZStringSerializer.cs


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