private void RegisterMongo(IOptionsMonitor <MongoOptions> options) { BsonDefaults.GuidRepresentation = options.CurrentValue.GuidRepresentation; var pack = new ConventionPack { new EnumRepresentationConvention(options.CurrentValue.EnumRepresentation == EnumRepresentation.Numeric ? BsonType.Int32 : BsonType.String), new IgnoreExtraElementsConvention(options.CurrentValue.IgnoreExtraElementsConvention), new IgnoreIfDefaultConvention(options.CurrentValue.IgnoreIfDefaultConvention) }; if (options.CurrentValue.UseCamelCaseConvention) { pack.Add(new CamelCaseElementNameConvention()); } ConventionRegistry.Register("Configured Solution Conventions", pack, t => true); BaseMap.Map(); }