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

            return(_lazyInstance.Value);
        }
示例#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();
 }
示例#4
0
 private DbSingleton(ICursesService cursesService)
 {
     _cursesService = cursesService;
 }