/// <summary> /// This returns the query-only version of the document storage /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="TId"></typeparam> /// <returns></returns> /// <exception cref="DocumentIdTypeMismatchException"></exception> internal IDocumentStorage <T, TId> QueryStorageFor <T, TId>() { var storage = _providers.StorageFor <T>().QueryOnly; if (storage is IDocumentStorage <T, TId> s) { return(s); } throw new DocumentIdTypeMismatchException(storage, typeof(TId)); }
public DocumentProvider <T> BuildPersistence(IProviderGraph graph, SubClassMapping mapping) { var inner = graph.StorageFor <TRoot>(); return(new DocumentProvider <T>() { QueryOnly = new SubClassDocumentStorage <T, TRoot, TId>((IDocumentStorage <TRoot, TId>)inner.QueryOnly, mapping), Lightweight = new SubClassDocumentStorage <T, TRoot, TId>((IDocumentStorage <TRoot, TId>)inner.Lightweight, mapping), IdentityMap = new SubClassDocumentStorage <T, TRoot, TId>((IDocumentStorage <TRoot, TId>)inner.IdentityMap, mapping), DirtyTracking = new SubClassDocumentStorage <T, TRoot, TId>((IDocumentStorage <TRoot, TId>)inner.DirtyTracking, mapping), BulkLoader = new SubClassBulkLoader <T, TRoot>(inner.BulkLoader) }); }
public DocumentProvider <T> StorageFor <T>() { if (_storage.TryFind(typeof(T), out var stored)) { return(stored.As <DocumentProvider <T> >()); } Tenant.EnsureStorageExists(typeof(T)); var persistence = _inner.StorageFor <T>(); _storage = _storage.AddOrUpdate(typeof(T), persistence); return(persistence); }
public IDocumentStorage <T> StorageFor <T>() { return(selectStorage(_providers.StorageFor <T>())); }
public IDocumentSourceCode Load(IProviderGraph providers) { return(providers.StorageFor <T>()); }
public IDocumentStorage Find(IProviderGraph providers) { return(providers.StorageFor <T>().Lightweight); }