diff --git a/src/EventDriven.SchemaRegistry.Mongo/EventDriven.SchemaRegistry.Mongo.csproj b/src/EventDriven.SchemaRegistry.Mongo/EventDriven.SchemaRegistry.Mongo.csproj index 709dc60..944a90d 100644 --- a/src/EventDriven.SchemaRegistry.Mongo/EventDriven.SchemaRegistry.Mongo.csproj +++ b/src/EventDriven.SchemaRegistry.Mongo/EventDriven.SchemaRegistry.Mongo.csproj @@ -3,7 +3,7 @@ net6.0 true - 1.1.0 + 1.2.0-beta1 Tony Sneed MIT eda-logo.jpeg @@ -12,7 +12,7 @@ https://github.com/event-driven-dotnet/EventDriven.SchemaRegistry.Mongo.git git schema-registry event-driven event-driven-architecture - https://github.com/event-driven-dotnet/EventDriven.SchemaRegistry.Mongo/releases/tag/v1.1.0 + https://github.com/event-driven-dotnet/EventDriven.SchemaRegistry.Mongo/releases/tag/v1.2.0-beta1 EventDriven.SchemaRegistry.Mongo EventDriven.SchemaRegistry.Mongo True @@ -21,11 +21,12 @@ True - + \ + diff --git a/src/EventDriven.SchemaRegistry.Mongo/MongoStateStoreOptions.cs b/src/EventDriven.SchemaRegistry.Mongo/MongoStateStoreOptions.cs index 24702be..0760c33 100644 --- a/src/EventDriven.SchemaRegistry.Mongo/MongoStateStoreOptions.cs +++ b/src/EventDriven.SchemaRegistry.Mongo/MongoStateStoreOptions.cs @@ -1,9 +1,11 @@ +using EventDriven.DependencyInjection.URF.Mongo; + namespace EventDriven.SchemaRegistry.Mongo { /// /// Mongo state Store options. /// - public class MongoStateStoreOptions + public class MongoStateStoreOptions : IMongoDbSettings { /// /// Mongo connection string. @@ -18,6 +20,6 @@ public class MongoStateStoreOptions /// /// Mongo schemas collection name. /// - public string SchemasCollectionName { get; set; } = "schemas"; + public string CollectionName { get; set; } = "schemas"; } } \ No newline at end of file diff --git a/src/EventDriven.SchemaRegistry.Mongo/ServiceCollectionExtensions.cs b/src/EventDriven.SchemaRegistry.Mongo/ServiceCollectionExtensions.cs index c785b5c..7a18e89 100644 --- a/src/EventDriven.SchemaRegistry.Mongo/ServiceCollectionExtensions.cs +++ b/src/EventDriven.SchemaRegistry.Mongo/ServiceCollectionExtensions.cs @@ -1,7 +1,8 @@ using System; +using EventDriven.DependencyInjection.URF.Mongo; using EventDriven.SchemaRegistry.Abstractions; using EventDriven.SchemaRegistry.Mongo; -using MongoDB.Bson.Serialization.Conventions; +using Microsoft.Extensions.Configuration; using MongoDB.Driver; using URF.Core.Abstractions; using URF.Core.Mongo; @@ -14,6 +15,24 @@ namespace Microsoft.Extensions.DependencyInjection /// public static class ServiceCollectionExtensions { + /// + /// Adds MongoSchemaRegistry services to the provided . + /// + /// The + /// The application's . + /// The original . + public static IServiceCollection AddMongoSchemaRegistry(this IServiceCollection services, IConfiguration configuration) + { + // Add MongoDb settings + services.AddMongoDbSettings(configuration); + + // Register services + services.AddSingleton(); + services.AddSingleton, DocumentRepository>(); + + return services; + } + /// /// Adds MongoSchemaRegistry services to the provided . /// @@ -32,7 +51,7 @@ public static IServiceCollection AddMongoSchemaRegistry(this IServiceCollection services.AddSingleton(sp => { var context = new MongoSchemaRegistryDbContext(new MongoClient(schemaOptions.ConnectionString), - schemaOptions.DatabaseName, schemaOptions.SchemasCollectionName); + schemaOptions.DatabaseName, schemaOptions.CollectionName); return context.MongoSchemas; }); @@ -40,13 +59,6 @@ public static IServiceCollection AddMongoSchemaRegistry(this IServiceCollection services.AddSingleton(); services.AddSingleton, DocumentRepository>(); - // Register caml case convention - var conventionPack = new ConventionPack - { - new CamelCaseElementNameConvention() - }; - ConventionRegistry.Register("camlCase", conventionPack, _ => true); - return services; } }