/// <summary> /// Gets all the configuration instances /// </summary> /// <returns></returns> internal static List <ConfigurationInstance> GetConfigurationInstances() { return(AssemblyUtility.GetAllTypes() .Where(_ => _.IsClass && !_.IsAbstract) .Select(CreateConfigurationEntryTuple) .Where(_ => _ != null) .ToList()); }
internal static IEnumerable <ICommunicationSchema> ScanForTSLCommunicationSchema(RunningMode schemaRunningMode) { Debug.Assert(schemaRunningMode == RunningMode.Server || schemaRunningMode == RunningMode.Proxy); var schema_interface_type = typeof(ICommunicationSchema); var default_schema_type = typeof(DefaultCommunicationSchema); var comm_instance_base_type = schemaRunningMode == RunningMode.Server ? typeof(TrinityServer) : typeof(TrinityProxy); var comm_instance_schema_attrs = from type in AssemblyUtility.GetAllTypes() where comm_instance_base_type.IsAssignableFrom(type) select type.GetCustomAttributes(typeof(CommunicationSchemaAttribute), inherit : true).FirstOrDefault() as CommunicationSchemaAttribute; var schema_instances = from schema_attr in comm_instance_schema_attrs where schema_attr != null select schema_attr.CommunicationSchemaType.GetConstructor(new Type[] { }).Invoke(new object[] { }) as ICommunicationSchema; return(schema_instances); }
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)); }