Merge pull request #52 from iprotect-technologies/master

Remove static variables from stores, closes #51
This commit is contained in:
Alexandre SPIESER
2022-03-07 23:05:45 +00:00
committed by GitHub
3 changed files with 11 additions and 11 deletions
+3 -3
View File
@@ -108,10 +108,10 @@ namespace AspNetCore.Identity.MongoDbCore
/// <summary>
/// Gets the database context for this store.
/// </summary>
private static IMongoDbContext Context { get; set; }
private IMongoDbContext Context { get; }
private static IMongoRepository _mongoRepository;
private static IMongoRepository MongoRepository
private IMongoRepository _mongoRepository;
private IMongoRepository MongoRepository
{
get
{
+3 -3
View File
@@ -103,10 +103,10 @@ namespace AspNetCore.Identity.MongoDbCore
/// <summary>
/// Gets the database context for this store.
/// </summary>
private static TContext Context { get; set; }
private TContext Context { get; }
private static IMongoRepository _mongoRepository;
private static IMongoRepository MongoRepository
private IMongoRepository _mongoRepository;
private IMongoRepository MongoRepository
{
get
{
+5 -5
View File
@@ -130,18 +130,18 @@ namespace AspNetCore.Identity.MongoDbCore
/// <summary>
/// Gets the database context for this store.
/// </summary>
private static TContext Context { get; set; }
private TContext Context { get; }
private static object MongoRepositoryInitializationLock = new object();
private static IMongoRepository _mongoRepository;
private static IMongoRepository MongoRepository
private readonly object _mongoRepositoryInitializationLock = new object();
private IMongoRepository _mongoRepository;
private IMongoRepository MongoRepository
{
get
{
// double checked locking to prevent race to initialize the repository in multithreaded environment.
if (_mongoRepository == null)
{
lock (MongoRepositoryInitializationLock)
lock (_mongoRepositoryInitializationLock)
{
if (_mongoRepository == null)
{