Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        /// <summary>构造函数</summary>
        public MasterSlavesStorageAdapter(IStorageSchema storageSchema)
        {
            // 获取存储架构信息
            this.storageSchema = storageSchema;

            // 初始化存储策略和存储节点信息
            this.Initialize();
        }
        /// <summary>构造函数</summary>
        public SingletonStorageAdapter(IStorageSchema storageSchema)
        {
            // 获取存储架构信息
            this.storageSchema = storageSchema;

            // 初始化存储策略和存储节点信息
            this.Initialize();
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        public static string SwigGen(IStorageSchema schema, string ModuleName)
        {
            var codeGenerators = MetaGen.CodeGenSwigJit(ManglingCode, schema);

            return(codeGenerators.Invoke(ModuleName));
        }
Esempio n. 8
0
 /// <summary></summary>
 /// <param name="storageSchema"></param>
 public DateTimeStorageStrategy(IStorageSchema storageSchema)
 {
     this.storageSchema = storageSchema;
 }
Esempio n. 9
0
 public Test(ITestOutputHelper output)
 {
     Global.Initialize();
     Output = output;
     Schema = CompositeStorage.AddStorageExtension("../../../tsl", "Some");
 }
 /// <summary></summary>
 public SingletonStorageStrategy(IStorageSchema storageSchema)
 {
     this.storageSchema = storageSchema;
 }
Esempio n. 11
0
 /// <summary></summary>
 /// <param name="storageSchema"></param>
 public HashCodeStorageStrategy(IStorageSchema storageSchema)
 {
     this.storageSchema = storageSchema;
 }
Esempio n. 12
0
 /// <summary></summary>
 /// <param name="storageSchema"></param>
 public IntegerStorageStrategy(IStorageSchema storageSchema)
 {
     this.storageSchema = storageSchema;
 }