=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Utils;
|
||||
/// <summary>
|
||||
/// Provides extension methods for configuring MongoDB integration on a host builder.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c198c69 -->
|
||||
public static class MongoDbHostBuilderExtension
|
||||
{
|
||||
/// <summary>
|
||||
@@ -21,6 +22,7 @@ public static class MongoDbHostBuilderExtension
|
||||
/// </summary>
|
||||
/// <param name="hostBuilder">The host builder to extend with the MongoDB configuration.</param>
|
||||
/// <returns>The same <see cref="IHostBuilder"/> instance, allowing further fluent configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=e4bedf4 body=7ed0573 -->
|
||||
public static IHostBuilder UseMongo(this IHostBuilder hostBuilder)
|
||||
{
|
||||
ConfigureMongoDbConventions();
|
||||
@@ -34,6 +36,7 @@ public static class MongoDbHostBuilderExtension
|
||||
/// </summary>
|
||||
/// <param name="host">The host whose services are used to resolve the <see cref="IMongoDatabase"/> instance.</param>
|
||||
/// <returns>The same <see cref="IHost"/> instance, enabling fluent chaining.</returns>
|
||||
/// <!-- aidoc:v1 sig=c767d9c body=fff8138 -->
|
||||
public static IHost RunMongoMigrations(this IHost host)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
@@ -63,6 +66,7 @@ public static class MongoDbHostBuilderExtension
|
||||
/// <returns>The configured <see cref="IMongoDatabase"/> instance.</returns>
|
||||
/// <exception cref="Exception">Thrown when the connection string or database name is null or empty.</exception>
|
||||
/// <exception cref="Exception">Thrown when the specified database does not exist.</exception>
|
||||
/// <!-- aidoc:v1 sig=302f4d6 body=0f9a4d3 -->
|
||||
private static IMongoDatabase ConfigureMongoDbConnection(IOptions<DatabaseSettings> dbSettings)
|
||||
{
|
||||
var connectionString = dbSettings.Value.ConnectionString;
|
||||
@@ -106,6 +110,7 @@ public static class MongoDbHostBuilderExtension
|
||||
/// Registers global MongoDB serialization conventions, including ignoring extra elements in BSON documents
|
||||
/// and using camelCase for element names, applied to all types in the application.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=470c959 body=7fdb696 -->
|
||||
public static void ConfigureMongoDbConventions()
|
||||
{
|
||||
var pack = new ConventionPack
|
||||
|
||||
Reference in New Issue
Block a user