I have a SQL-table with three columns: Id, English and Norwegian. Id is the primary key. In my application I have a flag (EN/NO) to decide which language to use for labels, buttons ++ in the GUI. The application is now doing a select * everytime the application loads, and the application is looking up all required values at runtime. But instead of loading the whole dataset for every instance, i want to export these values and create a dll so i can store these values locally.
有没有可能创建此代码, 使 Dll 会随着每栋建筑而更新自己? 还是我必须运行一些外部程序才能动态创建 ex. a. cs 代码才能复制/ 粘贴到我的班级? (我需要能够重新运行此进程, 因为每次需要新标签/ 文本时都会添加行)
到目前为止,我已想出三种解决方案 如何构建我的出口结构, 但对于如何输出数据却一无所知:
维护数据表在静态背景下的状况,并提供帮助方法,使取出值的方法标准化。
创建一个包含每个独特的代号为方法名的分类, 以及一个参数, 以决定返回的值 :
public static class Names { public static string 12345(string language) { switch (language) { case "EN": return "Hello"; case "NO": return "Hei"; default: return "Hello"; } } }
创建一个包含每种语言的可搜索列表的分类, ID为密钥和值( 作为值)