-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MongoDB.Driver v3 client integration package (#7034)
* Add MongoDB.Driver v3 client integration package MongoDB.Driver shipped a version `3.0.0` that has binary breaking changes such that we can't build a single library that can load in both v2.x and v3.x. To continue supporting new versions of MongoDB.Driver, we need to add a new component Aspire.MongoDB.Driver.v3 that will work with the new version of MongoDB.Driver. See #3956 for the strategy to deal with these breaking changes. Fix #6380 * Fix health check when using keyed service.
- Loading branch information
Showing
14 changed files
with
201 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Components/Aspire.MongoDB.Driver.v3/Aspire.MongoDB.Driver.v3.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(DefaultTargetFramework)</TargetFramework> | ||
<IsPackable>true</IsPackable> | ||
<PackageTags>$(ComponentDatabasePackageTags) MongoDB</PackageTags> | ||
<PackageIconFullPath>$(SharedDir)MongoDB_300px.png</PackageIconFullPath> | ||
<Description>A generic MongoDB client that integrates with Aspire.</Description> | ||
<MinCodeCoverage>86</MinCodeCoverage> | ||
<!-- MongoDB.Driver.Core.Extensions.DiagnosticSources is not signed --> | ||
<NoWarn>$(NoWarn);CS8002</NoWarn> | ||
<!-- Disable package validation as this package hasn't shipped yet. --> | ||
<EnablePackageValidation>false</EnablePackageValidation> | ||
|
||
<!-- Keep the same assembly name as the main library. --> | ||
<AssemblyName>Aspire.MongoDB.Driver</AssemblyName> | ||
<!-- PackageId defaults to AssemblyName, so need to reset it. --> | ||
<PackageId>$(MSBuildProjectName)</PackageId> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\Aspire.MongoDB.Driver\AspireMongoDBDriverExtensions.cs" /> | ||
<Compile Include="..\Aspire.MongoDB.Driver\AssemblyInfo.cs" /> | ||
<Compile Include="..\Aspire.MongoDB.Driver\MongoDBSettings.cs" /> | ||
<None Include="..\Aspire.MongoDB.Driver\README.md" Pack="true" PackagePath="\" /> | ||
|
||
<Compile Include="..\Common\ConfigurationSchemaAttributes.cs" Link="ConfigurationSchemaAttributes.cs" /> | ||
<Compile Include="..\Common\HealthChecksExtensions.cs" Link="HealthChecksExtensions.cs" /> | ||
<Compile Include="..\Common\ConnectionStringValidation.cs" Link="ConnectionStringValidation.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" /> | ||
<PackageReference Include="MongoDB.Driver" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" /> | ||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" /> | ||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" /> | ||
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" /> | ||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" /> | ||
</ItemGroup> | ||
|
||
</Project> |
63 changes: 63 additions & 0 deletions
63
src/Components/Aspire.MongoDB.Driver.v3/ConfigurationSchema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"definitions": { | ||
"logLevel": { | ||
"properties": { | ||
"MongoDB": { | ||
"$ref": "#/definitions/logLevelThreshold" | ||
}, | ||
"MongoDB.Command": { | ||
"$ref": "#/definitions/logLevelThreshold" | ||
}, | ||
"MongoDB.Connection": { | ||
"$ref": "#/definitions/logLevelThreshold" | ||
}, | ||
"MongoDB.Internal": { | ||
"$ref": "#/definitions/logLevelThreshold" | ||
}, | ||
"MongoDB.SDAM": { | ||
"$ref": "#/definitions/logLevelThreshold" | ||
}, | ||
"MongoDB.ServerSelection": { | ||
"$ref": "#/definitions/logLevelThreshold" | ||
} | ||
} | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"Aspire": { | ||
"type": "object", | ||
"properties": { | ||
"MongoDB": { | ||
"type": "object", | ||
"properties": { | ||
"Driver": { | ||
"type": "object", | ||
"properties": { | ||
"ConnectionString": { | ||
"type": "string", | ||
"description": "Gets or sets the connection string of the MongoDB database to connect to." | ||
}, | ||
"DisableHealthChecks": { | ||
"type": "boolean", | ||
"description": "Gets or sets a boolean value that indicates whether the MongoDB health check is disabled or not.", | ||
"default": false | ||
}, | ||
"DisableTracing": { | ||
"type": "boolean", | ||
"description": "Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not.", | ||
"default": false | ||
}, | ||
"HealthCheckTimeout": { | ||
"type": "integer", | ||
"description": "Gets or sets a integer value that indicates the MongoDB health check timeout in milliseconds." | ||
} | ||
}, | ||
"description": "Provides the client configuration settings for connecting to a MongoDB database using MongoDB driver." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#nullable enable |
14 changes: 14 additions & 0 deletions
14
src/Components/Aspire.MongoDB.Driver.v3/PublicAPI.Unshipped.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#nullable enable | ||
Aspire.MongoDB.Driver.MongoDBSettings | ||
Aspire.MongoDB.Driver.MongoDBSettings.ConnectionString.get -> string? | ||
Aspire.MongoDB.Driver.MongoDBSettings.ConnectionString.set -> void | ||
Aspire.MongoDB.Driver.MongoDBSettings.DisableHealthChecks.get -> bool | ||
Aspire.MongoDB.Driver.MongoDBSettings.DisableHealthChecks.set -> void | ||
Aspire.MongoDB.Driver.MongoDBSettings.DisableTracing.get -> bool | ||
Aspire.MongoDB.Driver.MongoDBSettings.DisableTracing.set -> void | ||
Aspire.MongoDB.Driver.MongoDBSettings.HealthCheckTimeout.get -> int? | ||
Aspire.MongoDB.Driver.MongoDBSettings.HealthCheckTimeout.set -> void | ||
Aspire.MongoDB.Driver.MongoDBSettings.MongoDBSettings() -> void | ||
Microsoft.Extensions.Hosting.AspireMongoDBDriverExtensions | ||
static Microsoft.Extensions.Hosting.AspireMongoDBDriverExtensions.AddKeyedMongoDBClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Aspire.MongoDB.Driver.MongoDBSettings!>? configureSettings = null, System.Action<MongoDB.Driver.MongoClientSettings!>? configureClientSettings = null) -> void | ||
static Microsoft.Extensions.Hosting.AspireMongoDBDriverExtensions.AddMongoDBClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! connectionName, System.Action<Aspire.MongoDB.Driver.MongoDBSettings!>? configureSettings = null, System.Action<MongoDB.Driver.MongoClientSettings!>? configureClientSettings = null) -> void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tests/Aspire.MongoDB.Driver.v3.Tests/Aspire.MongoDB.Driver.v3.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(DefaultTargetFramework)</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="$(RepoRoot)src\Components\Aspire.MongoDB.Driver\ConfigurationSchema.json" CopyToOutputDirectory="PreserveNewest" /> | ||
<Compile Include="$(RepoRoot)src\Aspire.Hosting.MongoDB\MongoDBContainerImageTags.cs" /> | ||
|
||
<Compile Include="..\Aspire.MongoDB.Driver.Tests\AspireMongoDBDriverExtensionsTests.cs" /> | ||
<Compile Include="..\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs" /> | ||
<Compile Include="..\Aspire.MongoDB.Driver.Tests\MongoDbContainerFixture.cs" /> | ||
<Compile Include="..\Aspire.MongoDB.Driver.Tests\MongoDBDriverPublicApiTests.cs" /> | ||
|
||
<ProjectReference Include="..\..\src\Components\Aspire.MongoDB.Driver.v3\Aspire.MongoDB.Driver.v3.csproj" /> | ||
<ProjectReference Include="..\Aspire.Components.Common.Tests\Aspire.Components.Common.Tests.csproj" /> | ||
|
||
<PackageReference Include="TestContainers.MongoDb" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters