public StorageEntityManager(StorageEntityDefinition <T> definition, IStorageConfiguration configuration) { EntityDefinition = definition; Wrapper = StorageWrapperFactory.GetWrapper(definition, configuration); Queryable = new StorageQueryable <T>(this); Configuration = configuration; }
public static StorageWrapper <T> GetWrapper <T>(StorageEntityDefinition <T> definition, IStorageConfiguration configuration) { if (!RegisteredWrappers.ContainsKey(definition.StorageType)) { throw new StorageArgumentException($"Not found wrapper for storage type: {definition.StorageType}"); } var genericType = RegisteredWrappers[definition.StorageType]; var storageWrapperType = genericType.MakeGenericType(typeof(T)); return((StorageWrapper <T>)Activator.CreateInstance(storageWrapperType, definition, configuration)); }