以前我使用这个调用来加载从 Rule 类扩展的所有 cs 文件
var repository = new RuleRepository();
repository.Load(x => x.From(typeof(Rule1).Assembly));
通过调用如上所示的 Load 方法,所有与 Rule1.cs 相同类型的类文件(意味着从 Rule 类扩展的所有文件)都被加载到存储库内存中。目前我已决定将所有这些.cs 文件(即 Rule1.cs)转换为 dll 并扫描包含这些 dll 的文件夹。我怎样才能实现这种行为?目前我正在做这样的事情
Assembly assembly1 = Assembly.LoadFile(Server.MapPath("Rule1.dll"));
List<Assembly> asmblyList = new List<Assembly>();
asmblyList.Add(assembly1);
repository.Load(x => x.From(asmblyList));
我想从文件夹中扫描所有 Rule1.dll 类型的程序集。我怎么可能做到?任何帮助都会很棒。