File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -8,18 +8,18 @@ public interface IDocumentStoreFactory
88
99public class DocumentStoreFactory : IDocumentStoreFactory
1010{
11- private readonly ConcurrentDictionary < string , IDocumentStore > _stores ;
11+ private readonly ConcurrentDictionary < string , Lazy < IDocumentStore > > _stores ;
1212
1313 public DocumentStoreFactory ( )
1414 {
15- _stores = new ConcurrentDictionary < string , IDocumentStore > ( ) ;
15+ _stores = new ConcurrentDictionary < string , Lazy < IDocumentStore > > ( ) ;
1616 }
1717
1818 public IDocumentStore GetStore ( string tenantId )
1919 {
20- if ( _stores . TryGetValue ( tenantId , out IDocumentStore value ) )
20+ if ( _stores . TryGetValue ( tenantId , out var value ) )
2121 {
22- return value ;
22+ return value . Value ;
2323 }
2424
2525 var store = new DocumentStore
@@ -30,7 +30,7 @@ public IDocumentStore GetStore(string tenantId)
3030
3131 store . Initialize ( ) ;
3232
33- _stores [ tenantId ] = store ;
33+ _stores [ tenantId ] = new Lazy < IDocumentStore > ( store ) ;
3434
3535 return store ;
3636 }
You can’t perform that action at this time.
0 commit comments