private static void _RegisterTSLStorageExtension(IGenericCellOperations genericCellOps, IStorageSchema storageSchema) { if (genericCellOps == null) { throw new ArgumentNullException("genericCellOps"); } if (storageSchema == null) { throw new ArgumentNullException("storageSchema"); } if (genericCellOps.GetType().Assembly != storageSchema.GetType().Assembly) { throw new ArgumentException("Components being registered are from different storage extensions."); } if (storageSchema is IStorageSchemaUpdateNotifier notifier) { notifier.StorageSchemaUpdated += StorageSchemaUpdated; } EventRaiser.RaiseStorageEvent(StorageSchemaUpdated, nameof(StorageSchemaUpdated)); if (storage_schema is IStorageSchemaUpdateNotifier old_notifier) { old_notifier.StorageSchemaUpdated -= StorageSchemaUpdated; } generic_cell_ops = genericCellOps; storage_schema = storageSchema; }
internal void RegisterGenericOperationsProvider(IGenericCellOperations cloud_operations) { m_SaveGenericCell_ICell = cloud_operations.SaveGenericCell; m_LoadGenericCell_long = cloud_operations.LoadGenericCell; m_NewGenericCell_string = cloud_operations.NewGenericCell; m_NewGenericCell_long_string = cloud_operations.NewGenericCell; m_NewGenericCell_string_string = cloud_operations.NewGenericCell; }
private static Tuple <IGenericCellOperations, IStorageSchema, int> _LoadTSLStorageExtension(Assembly extension_assembly) { Type default_provider_type = typeof(DefaultGenericCellOperations); Type schema_interface_type = typeof(IStorageSchema); Type default_storage_schema_type = typeof(DefaultStorageSchema); IGenericCellOperations _generic_cell_ops = null; IStorageSchema _storage_schema = null; int priority = 0; var provider_type = AssemblyUtility.GetAllClassTypes <IGenericCellOperations>(_ => _ != default_provider_type, extension_assembly).FirstOrDefault(); if (provider_type == null) { goto _return; } var schema_type = AssemblyUtility.GetAllClassTypes <IStorageSchema>(_ => _ != default_storage_schema_type, extension_assembly).FirstOrDefault(); if (schema_type == null) { goto _return; } var pdict = ExtensionConfig.Instance.ResolveTypePriorities(); try { _generic_cell_ops = provider_type.GetConstructor(new Type[] { }).Invoke(new object[] { }) as IGenericCellOperations; _storage_schema = schema_type.GetConstructor(new Type[] { }).Invoke(new object[] { }) as IStorageSchema; if (pdict.TryGetValue(provider_type, out var provider_priority)) { priority = provider_priority; } if (pdict.TryGetValue(schema_type, out var schema_priority)) { priority = schema_priority; } } catch { _generic_cell_ops = null; _storage_schema = null; } _return: return(Tuple.Create(_generic_cell_ops, _storage_schema, priority)); }
internal void RegisterGenericOperationsProvider(IGenericCellOperations operations) { m_SaveGenericCell_ICell = operations.SaveGenericCell; m_SaveGenericCell_long_ICell = operations.SaveGenericCell; m_SaveGenericCell_CellAccessOptions_ICell = operations.SaveGenericCell; m_SaveGenericCell_CellAccessOptions_long_ICell = operations.SaveGenericCell; m_LoadGenericCell_long = operations.LoadGenericCell; m_NewGenericCell_string = operations.NewGenericCell; m_NewGenericCell_long_string = operations.NewGenericCell; m_NewGenericCell_string_string = operations.NewGenericCell; m_UseGenericCell_long = operations.UseGenericCell; m_UseGenericCell_long_CellAccessOptions = operations.UseGenericCell; m_EnumerateGenericCells = operations.EnumerateGenericCells; m_EnumerateGenericCellAccessors = operations.EnumerateGenericCellAccessors; }
private static void _RegisterTSLStorageExtension(IGenericCellOperations genericCellOps, IStorageSchema storageSchema) { if (genericCellOps == null) { throw new ArgumentNullException("genericCellOps"); } if (storageSchema == null) { throw new ArgumentNullException("storageSchema"); } if (genericCellOps.GetType().Assembly != storageSchema.GetType().Assembly) { throw new ArgumentException("Components being registered are from different storage extensions."); } generic_cell_ops = genericCellOps; storage_schema = storageSchema; }
private static Tuple <IGenericCellOperations, IStorageSchema> _LoadTSLStorageExtension(Assembly extension_assembly) { Type provider_interface_type = typeof(IGenericCellOperations); Type default_provider_type = typeof(DefaultGenericCellOperations); Type schema_interface_type = typeof(IStorageSchema); Type default_storage_schema_type = typeof(DefaultStorageSchema); IGenericCellOperations _generic_cell_ops = null; IStorageSchema _storage_schema = null; var provider_type = (from type in AssemblyUtility.GetAllTypes(extension_assembly) where type.IsClass && provider_interface_type.IsAssignableFrom(type) && type != default_provider_type select type).FirstOrDefault(); if (provider_type == null) { goto _return; } var schema_type = (from type in AssemblyUtility.GetAllTypes(extension_assembly) where type.IsClass && schema_interface_type.IsAssignableFrom(type) && type != default_storage_schema_type select type).FirstOrDefault(); if (schema_type == null) { goto _return; } try { _generic_cell_ops = provider_type.GetConstructor(new Type[] { }).Invoke(new object[] { }) as IGenericCellOperations; _storage_schema = schema_type.GetConstructor(new Type[] { }).Invoke(new object[] { }) as IStorageSchema; } catch { _generic_cell_ops = null; _storage_schema = null; } _return: return(Tuple.Create(_generic_cell_ops, _storage_schema)); }