/* Copyright 2010-2015 MongoDB Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace MongoDB.Bson.Serialization { /// /// An interface implemented by a serializer. /// public interface IBsonSerializer { // properties /// /// Gets the type of the value. /// /// /// The type of the value. /// Type ValueType { get; } // methods /// /// Deserializes a value. /// /// The deserialization context. /// The deserialization args. /// A deserialized value. object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args); /// /// Serializes a value. /// /// The serialization context. /// The serialization args. /// The value. void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value); } /// /// An interface implemented by a serializer for values of type TValue. /// /// The type that this serializer knows how to serialize. public interface IBsonSerializer : IBsonSerializer { /// /// Deserializes a value. /// /// The deserialization context. /// The deserialization args. /// A deserialized value. new TValue Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args); /// /// Serializes a value. /// /// The serialization context. /// The serialization args. /// The value. void Serialize(BsonSerializationContext context, BsonSerializationArgs args, TValue value); } }