public DbContext(ICursesService cursesService)
 {
     _dbSingleton = DbSingleton.GetInstanceAsync(cursesService)
                    .ConfigureAwait(false)
                    .GetAwaiter()
                    .GetResult();
 }
Exemple #2
0
        public static async Task <DbSingleton> GetInstanceAsync(ICursesService cursesService)
        {
            await LazyInitializer(cursesService);

            return(_lazyInstance.Value);
        }
Exemple #3
0
 private static async Task LazyInitializer(ICursesService cursesService)
 {
     _lazyInstance = new Lazy <DbSingleton>(() => new DbSingleton(cursesService),
                                            LazyThreadSafetyMode.ExecutionAndPublication);
     _lazyInstance.Value.Valutes = await _lazyInstance.Value._cursesService.GetValutes();
 }
Exemple #4
0
 private DbSingleton(ICursesService cursesService)
 {
     _cursesService = cursesService;
 }