MongoDB.Bson.Serialization.Conventions.ConventionProfile.GetNewConventions C# (CSharp) Method

GetNewConventions() private method

Creates a convention pack from the ConventionProfile.
private GetNewConventions ( ) : IEnumerable
return IEnumerable
        private IEnumerable<IConvention> GetNewConventions()
        {
            var pack = new ConventionPack();

            // need to process defaults...
            pack.Append(DefaultConventionPack.Instance);

            // class mapping conventions
            if (MemberFinderConvention != null)
            {
                pack.Add(new MemberFinderConventionAdapter(MemberFinderConvention));
            }
            if (IdMemberConvention != null)
            {
                pack.Add(new IdMemberConventionAdapter(IdMemberConvention));
            }
            if (IdGeneratorConvention != null)
            {
                pack.Add(new IdGeneratorConventionAdapter(IdGeneratorConvention));
            }
            if (ExtraElementsMemberConvention != null)
            {
                pack.Add(new ExtraElementsConventionAdapter(ExtraElementsMemberConvention));
            }
            if (IgnoreExtraElementsConvention != null)
            {
                pack.Add(new IgnoreExtraElementsConventionAdapter(IgnoreExtraElementsConvention));
            }

            // member mapping conventions
            if (DefaultValueConvention != null)
            {
                pack.Add(new DefaultValueConventionAdapter(DefaultValueConvention));
            }
            if (SerializeDefaultValueConvention != null)
            {
                pack.Add(new SerializeDefaultValueConventionAdapter(SerializeDefaultValueConvention));
            }
            if (IgnoreIfDefaultConvention != null)
            {
                pack.Add(new IgnoreIfDefaultConventionAdapter(IgnoreIfDefaultConvention));
            }
            if (IgnoreIfNullConvention != null)
            {
                pack.Add(new IgnoreIfNullConventionAdapter(IgnoreIfNullConvention));
            }
            if (SerializationOptionsConvention != null)
            {
                pack.Add(new SerializationOptionsConventionAdapter(SerializationOptionsConvention));
            }
            if (ElementNameConvention != null)
            {
                pack.Add(new ElementNameConventionAdapter(ElementNameConvention));
            }

            // still need to process attributes
            pack.Append(AttributeConventionPack.Instance);
            return pack.Conventions;
        }