public SetElementNameConvention ( IElementNameConvention convention ) : |
||
convention | IElementNameConvention | An element name convention. |
return |
protected override void ConfigureConventions(Nancy.Conventions.NancyConventions nancyConventions) { base.ConfigureConventions(nancyConventions); var profile = new ConventionProfile(); profile.SetElementNameConvention(new CamelCaseElementNameConvention()); MongoDB.Bson.Serialization.BsonClassMap.RegisterConventions(profile, _ => true); }
public void TestConventionProfileStillUsesDefaults() { #pragma warning disable 618 var conventions = new ConventionProfile(); conventions.SetElementNameConvention(new CamelCaseElementNameConvention()); BsonClassMap.RegisterConventions(conventions, t => t == typeof(A)); #pragma warning restore 618 var classMap = new BsonClassMap<A>(); classMap.AutoMap(); var memberMap = classMap.GetMemberMap(x => x.S); Assert.IsNotNull(memberMap); }
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); }