Beispiel #1
0
        public void AfterPropertiesSet()
        {
            var defaultProfile = ConventionProfile.GetDefault();

            _profile = new ConventionProfile();
            _filter  = new ConventionFilterHelper(IncludeFilters, ExcludeFilters);

            _profile.SetDefaultValueConvention(DefaultValueConvention ?? defaultProfile.DefaultValueConvention);
            _profile.SetElementNameConvention(ElementNameConvention ?? defaultProfile.ElementNameConvention);
            _profile.SetExtraElementsMemberConvention(ExtraElementsMemberConvention ?? defaultProfile.ExtraElementsMemberConvention);
            _profile.SetIdGeneratorConvention(IdGeneratorConvention ?? defaultProfile.IdGeneratorConvention);
            _profile.SetIdMemberConvention(IdMemberConvention ?? defaultProfile.IdMemberConvention);
            _profile.SetIgnoreExtraElementsConvention(IgnoreExtraElementsConvention ?? defaultProfile.IgnoreExtraElementsConvention);
            _profile.SetIgnoreIfDefaultConvention(IgnoreIfDefaultConvention ?? defaultProfile.IgnoreIfDefaultConvention);
            _profile.SetIgnoreIfNullConvention(IgnoreIfNullConvention ?? defaultProfile.IgnoreIfNullConvention);
            _profile.SetMemberFinderConvention(MemberFinderConvention ?? defaultProfile.MemberFinderConvention);
            _profile.SetSerializationOptionsConvention(SerializationOptionsConvention ?? defaultProfile.SerializationOptionsConvention);

            BsonClassMap.RegisterConventions(_profile, _filter.Filter);
        }
        public void AfterPropertiesSet()
        {
            var defaultProfile = ConventionProfile.GetDefault();
            _profile = new ConventionProfile();
            _filter = new ConventionFilterHelper(IncludeFilters, ExcludeFilters);

            _profile.SetDefaultValueConvention(DefaultValueConvention ?? defaultProfile.DefaultValueConvention);
            _profile.SetElementNameConvention(ElementNameConvention ?? defaultProfile.ElementNameConvention);
            _profile.SetExtraElementsMemberConvention(ExtraElementsMemberConvention ?? defaultProfile.ExtraElementsMemberConvention);
            _profile.SetIdGeneratorConvention(IdGeneratorConvention ?? defaultProfile.IdGeneratorConvention);
            _profile.SetIdMemberConvention(IdMemberConvention ?? defaultProfile.IdMemberConvention);
            _profile.SetIgnoreExtraElementsConvention(IgnoreExtraElementsConvention ?? defaultProfile.IgnoreExtraElementsConvention);
            _profile.SetIgnoreIfDefaultConvention(IgnoreIfDefaultConvention ?? defaultProfile.IgnoreIfDefaultConvention);
            _profile.SetIgnoreIfNullConvention(IgnoreIfNullConvention ?? defaultProfile.IgnoreIfNullConvention);
            _profile.SetMemberFinderConvention(MemberFinderConvention ?? defaultProfile.MemberFinderConvention);
            _profile.SetSerializationOptionsConvention(SerializationOptionsConvention ?? defaultProfile.SerializationOptionsConvention);

            BsonClassMap.RegisterConventions(_profile, _filter.Filter);
        }