static void Main(string[] args) { ProgramMode mode = ConfigHelper.GetProGramType(); IDbExcute dbExcute = DbExcuteFactory.CreateDbExcute(mode); dbExcute.ExcuteDbMethod(); }
public SQLInstance(string Name, Dictionary <string, List <PropertyInfo> > pro, string ConnectionString) { this.name = Name; this.connectionString = ConnectionString; conn = new SqlConnection(ConnectionString); this.pro = pro; excute = new SQLExcute(conn, pro); }
public static IDbExcute CreateDbExcute(ProgramMode mode) { string name = Enum.GetName(typeof(ProgramMode), mode); Assembly assembly = Assembly.GetExecutingAssembly(); // 获取当前程序集 IDbExcute dbExcute = (IDbExcute)assembly.CreateInstance($"MyWebApiProject.DbToJsonFileTool.Service.{name}"); return(dbExcute); }