示例#1
0
        protected async Task <TStorageAdapter> GetAdapterAsync <TStorageAdapter>()
            where TStorageAdapter : class, IStorageAdapter
        {
            if (_adapter != null)
            {
                return((TStorageAdapter)_adapter);
            }

            using (await _asyncLock.LockAsync())
            {
                if (_adapter != null)
                {
                    return((TStorageAdapter)_adapter);
                }

                _adapter         = _container.Resolve <TStorageAdapter>();
                _adapter.Install = _install;

                await _adapter.InitializeAsync().ConfigureAwait(false);
            }

            return((TStorageAdapter)_adapter);
        }