public DbContextScope(ILocalCache cache, Func<ApiContext> apiContextCreator, ISettingsStorage settingsStorage) { _parentScope = GetAmbientScope(); if (_parentScope == null) _contexts = new DbContexts(cache, apiContextCreator, settingsStorage); else { _contexts = _parentScope._contexts; _nested = true; } SetAmbientScope(this); }