File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/providers/WorkflowCore.Persistence.MongoDB Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,25 @@ namespace Microsoft.Extensions.DependencyInjection
99{
1010 public static class ServiceCollectionExtensions
1111 {
12- public static WorkflowOptions UseMongoDB ( this WorkflowOptions options , string mongoUrl , string databaseName )
12+ public static WorkflowOptions UseMongoDB (
13+ this WorkflowOptions options ,
14+ string mongoUrl ,
15+ string databaseName ,
16+ Action < MongoClientSettings > configureClient = default )
1317 {
1418 options . UsePersistence ( sp =>
1519 {
16- var client = new MongoClient ( mongoUrl ) ;
20+ var mongoClientSettings = MongoClientSettings . FromConnectionString ( mongoUrl ) ;
21+ configureClient ? . Invoke ( mongoClientSettings ) ;
22+ var client = new MongoClient ( mongoClientSettings ) ;
1723 var db = client . GetDatabase ( databaseName ) ;
1824 return new MongoPersistenceProvider ( db ) ;
1925 } ) ;
2026 options . Services . AddTransient < IWorkflowPurger > ( sp =>
2127 {
22- var client = new MongoClient ( mongoUrl ) ;
28+ var mongoClientSettings = MongoClientSettings . FromConnectionString ( mongoUrl ) ;
29+ configureClient ? . Invoke ( mongoClientSettings ) ;
30+ var client = new MongoClient ( mongoClientSettings ) ;
2331 var db = client . GetDatabase ( databaseName ) ;
2432 return new WorkflowPurger ( db ) ;
2533 } ) ;
You can’t perform that action at this time.
0 commit comments