/* Copyright 2010-2011 10gen 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; using System.Collections.Generic; using System.Linq; using System.Text; namespace MongoDB.Bson.Serialization.Attributes { /// /// Specifies whether extra elements should be ignored when this class is deserialized. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] public class BsonIgnoreExtraElementsAttribute : Attribute { // private fields private bool ignoreExtraElements; private bool inherited; // constructors /// /// Initializes a new instance of the BsonIgnoreExtraElementsAttribute class. /// public BsonIgnoreExtraElementsAttribute() : this(true, false) { } /// /// Initializes a new instance of the BsonIgnoreExtraElementsAttribute class. /// /// Whether extra elements should be ignored when this class is deserialized. public BsonIgnoreExtraElementsAttribute(bool ignoreExtraElements) : this(ignoreExtraElements, false) { } /// /// Initializes a new instance of the BsonIgnoreExtraElementsAttribute class. /// /// Whether extra elements should be ignored when this class is deserialized. /// Whether derived classes inherit this attribute. public BsonIgnoreExtraElementsAttribute(bool ignoreExtraElements, bool inherited) { this.ignoreExtraElements = ignoreExtraElements; this.inherited = inherited; } // public properties /// /// Gets whether extra elements should be ignored when this class is deserialized. /// public bool IgnoreExtraElements { get { return ignoreExtraElements; } } // public properties /// /// Gets whether derived classes inherit this attribute. /// public bool Inherited { get { return inherited; } } } }