using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace IStation.StoreQueueFactory { public sealed partial class DataAccess { private const string DllName_RabbitMq = "IStation.StoreQueue4RabbitMq";//RabbitMq DLL 名称 private const string DllName_Kafka = "IStation.StoreQueue4Kafka";//Kafka DLL 名称 //获取DLL名称 private static string DllName { get { var selector = Settings.Queue.Selector_Store.ToUpper(); if (selector == Queue.RabbitMq.ToUpper()) { return DllName_RabbitMq; } if (selector == Queue.Kafka.ToUpper()) { return DllName_Kafka; } return default; } } /// /// 创建QUEUE /// public static I CreateQueue() { var type = typeof(I); var className = string.Format("{0}.{1}", "IStation.StoreQueue", type.Name.Remove(0, 1)); var obj = Assembly.Load(DllName).CreateInstance(className); return (I)obj; } } }