當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。