/// <summary>
 /// Sets the serialize default value convention.
 /// </summary>
 /// <param name="convention">A serialize default value convention.</param>
 /// <returns>The convention profile.</returns>
 public ConventionProfile SetSerializeDefaultValueConvention(
     ISerializeDefaultValueConvention convention
     )
 {
     SerializeDefaultValueConvention = convention;
     return(this);
 }
示例#2
0
        public ConventionProfile SetSerializeDefaultValueConvention(ISerializeDefaultValueConvention convention)
        {
            if (convention != null && IgnoreIfDefaultConvention != null)
            {
                throw new InvalidOperationException("SerializeDefaultValueConvention cannot be set because IgnoreIfDefaultConvention is set.");
            }
#pragma warning disable 618 // SerializeDefaultValueConvention is obsolete
            SerializeDefaultValueConvention = convention;
#pragma warning restore 618
            return(this);
        }
        // public methods
        /// <summary>
        /// Merges another convention profile into this one (only missing conventions are merged).
        /// </summary>
        /// <param name="other">The other convention profile.</param>
        public void Merge(ConventionProfile other)
        {
            if (DefaultValueConvention == null)
            {
                DefaultValueConvention = other.DefaultValueConvention;
            }
            if (ElementNameConvention == null)
            {
                ElementNameConvention = other.ElementNameConvention;
            }
            if (ExtraElementsMemberConvention == null)
            {
                ExtraElementsMemberConvention = other.ExtraElementsMemberConvention;
            }
            if (IdGeneratorConvention == null)
            {
                IdGeneratorConvention = other.IdGeneratorConvention;
            }
            if (IdMemberConvention == null)
            {
                IdMemberConvention = other.IdMemberConvention;
            }
            if (IgnoreExtraElementsConvention == null)
            {
                IgnoreExtraElementsConvention = other.IgnoreExtraElementsConvention;
            }
#pragma warning disable 618 // SerializeDefaultValueConvention is obsolete
            if (IgnoreIfDefaultConvention == null && SerializeDefaultValueConvention == null)
            {
                if (other.SerializeDefaultValueConvention != null)
                {
                    SerializeDefaultValueConvention = other.SerializeDefaultValueConvention;
                }
                else
                {
                    IgnoreIfDefaultConvention = other.IgnoreIfDefaultConvention;
                }
            }
#pragma warning restore 618
            if (IgnoreIfNullConvention == null)
            {
                IgnoreIfNullConvention = other.IgnoreIfNullConvention;
            }
            if (MemberFinderConvention == null)
            {
                MemberFinderConvention = other.MemberFinderConvention;
            }
            if (SerializationOptionsConvention == null)
            {
                SerializationOptionsConvention = other.SerializationOptionsConvention;
            }
        }
 /// <summary>
 /// Merges another convention profile into this one (only missing conventions are merged).
 /// </summary>
 /// <param name="other">The other convention profile.</param>
 public void Merge(
     ConventionProfile other
     )
 {
     if (IdGeneratorConvention == null)
     {
         IdGeneratorConvention = other.IdGeneratorConvention;
     }
     if (DefaultValueConvention == null)
     {
         DefaultValueConvention = other.DefaultValueConvention;
     }
     if (ElementNameConvention == null)
     {
         ElementNameConvention = other.ElementNameConvention;
     }
     if (ExtraElementsMemberConvention == null)
     {
         ExtraElementsMemberConvention = other.ExtraElementsMemberConvention;
     }
     if (IdMemberConvention == null)
     {
         IdMemberConvention = other.IdMemberConvention;
     }
     if (IgnoreExtraElementsConvention == null)
     {
         IgnoreExtraElementsConvention = other.IgnoreExtraElementsConvention;
     }
     if (IgnoreIfNullConvention == null)
     {
         IgnoreIfNullConvention = other.IgnoreIfNullConvention;
     }
     if (MemberFinderConvention == null)
     {
         MemberFinderConvention = other.MemberFinderConvention;
     }
     if (SerializeDefaultValueConvention == null)
     {
         SerializeDefaultValueConvention = other.SerializeDefaultValueConvention;
     }
 }
示例#5
0
 public SerializeDefaultValueConventionAdapter(ISerializeDefaultValueConvention convention)
 {
     _convention = convention;
 }
 public void Merge(
     ConventionProfile other
 )
 {
     if (BsonIdGeneratorConvention == null) {
         BsonIdGeneratorConvention = other.BsonIdGeneratorConvention;
     }
     if (DefaultValueConvention == null) {
         DefaultValueConvention = other.DefaultValueConvention;
     }
     if (ElementNameConvention == null) {
         ElementNameConvention = other.ElementNameConvention;
     }
     if (IdMemberConvention == null) {
         IdMemberConvention = other.IdMemberConvention;
     }
     if (IgnoreExtraElementsConvention == null) {
         IgnoreExtraElementsConvention = other.IgnoreExtraElementsConvention;
     }
     if (IgnoreIfNullConvention == null) {
         IgnoreIfNullConvention = other.IgnoreIfNullConvention;
     }
     if(MemberFinderConvention == null) {
         MemberFinderConvention = other.MemberFinderConvention;
     }
     if (SerializeDefaultValueConvention == null) {
         SerializeDefaultValueConvention = other.SerializeDefaultValueConvention;
     }
 }
 public ConventionProfile SetSerializeDefaultValueConvention(
     ISerializeDefaultValueConvention convention
 )
 {
     SerializeDefaultValueConvention = convention;
     return this;
 }
 public SerializeDefaultValueConventionAdapter(ISerializeDefaultValueConvention convention)
 {
     _convention = convention;
 }
        public ConventionProfile SetSerializeDefaultValueConvention(ISerializeDefaultValueConvention convention)
        {
            if (convention != null && IgnoreIfDefaultConvention != null)
            {
                throw new InvalidOperationException("SerializeDefaultValueConvention cannot be set because IgnoreIfDefaultConvention is set.");
            }
#pragma warning disable 618 // SerializeDefaultValueConvention is obsolete
            SerializeDefaultValueConvention = convention;
#pragma warning restore 618
            return this;
        }
示例#10
0
 // public methods
 /// <summary>
 /// Merges another convention profile into this one (only missing conventions are merged).
 /// </summary>
 /// <param name="other">The other convention profile.</param>
 public void Merge(ConventionProfile other)
 {
     if (DefaultValueConvention == null)
     {
         DefaultValueConvention = other.DefaultValueConvention;
     }
     if (ElementNameConvention == null)
     {
         ElementNameConvention = other.ElementNameConvention;
     }
     if (ExtraElementsMemberConvention == null)
     {
         ExtraElementsMemberConvention = other.ExtraElementsMemberConvention;
     }
     if (IdGeneratorConvention == null)
     {
         IdGeneratorConvention = other.IdGeneratorConvention;
     }
     if (IdMemberConvention == null)
     {
         IdMemberConvention = other.IdMemberConvention;
     }
     if (IgnoreExtraElementsConvention == null)
     {
         IgnoreExtraElementsConvention = other.IgnoreExtraElementsConvention;
     }
     #pragma warning disable 618 // SerializeDefaultValueConvention is obsolete
     if (IgnoreIfDefaultConvention == null && SerializeDefaultValueConvention == null)
     {
         if (other.SerializeDefaultValueConvention != null)
         {
             SerializeDefaultValueConvention = other.SerializeDefaultValueConvention;
         }
         else
         {
             IgnoreIfDefaultConvention = other.IgnoreIfDefaultConvention;
         }
     }
     #pragma warning restore 618
     if (IgnoreIfNullConvention == null)
     {
         IgnoreIfNullConvention = other.IgnoreIfNullConvention;
     }
     if (MemberFinderConvention == null)
     {
         MemberFinderConvention = other.MemberFinderConvention;
     }
     if (SerializationOptionsConvention == null)
     {
         SerializationOptionsConvention = other.SerializationOptionsConvention;
     }
 }
 public ConventionProfile SetSerializeDefaultValueConvention(ISerializeDefaultValueConvention convention)
 {
     if (convention != null && IgnoreIfDefaultConvention != null)
     {
         throw new InvalidOperationException("SerializeDefaultValueConvention cannot be set because IgnoreIfDefaultConvention is set.");
     }
     SerializeDefaultValueConvention = convention;
     return this;
 }