示例#1
0
        public void Serialize(global::MongoDB.Bson.IO.BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            JobDetailImpl item = (JobDetailImpl)value;

            bsonWriter.WriteStartDocument();

            bsonWriter.WriteName("_id");
            BsonSerializer.Serialize <JobKey>(bsonWriter, item.Key);

            bsonWriter.WriteString("_t", "JobDetailImpl");
            bsonWriter.WriteString("_assembly", item.JobType.Assembly.FullName);
            bsonWriter.WriteString("_class", item.JobType.FullName);

            bsonWriter.WriteString("Name", item.Name);
            bsonWriter.WriteString("Group", item.Group);
            bsonWriter.WriteBoolean("RequestRecovery", item.RequestsRecovery);
            bsonWriter.WriteBoolean("Durable", item.Durable);

            bsonWriter.WriteName("JobDataMap");
            BsonSerializer.Serialize(bsonWriter, item.JobDataMap);

            /*bsonWriter.WriteName("Description");
             * BsonSerializer.Serialize<string>(bsonWriter, item.Description);*/

            bsonWriter.WriteEndDocument();
        }
示例#2
0
        public void Serialize(global::MongoDB.Bson.IO.BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            var item = (JobDataMap)value;

            bsonWriter.WriteStartDocument();

            foreach (string key in item.Keys)
            {
                bsonWriter.WriteName(key);
                BsonSerializer.Serialize(bsonWriter, item[key]);
            }

            bsonWriter.WriteEndDocument();
        }