コード例 #1
0
 public StorageEntityManager(StorageEntityDefinition <T> definition, IStorageConfiguration configuration)
 {
     EntityDefinition = definition;
     Wrapper          = StorageWrapperFactory.GetWrapper(definition, configuration);
     Queryable        = new StorageQueryable <T>(this);
     Configuration    = configuration;
 }
コード例 #2
0
        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));
        }