我们创建一个通用模块(BaseModule
问题是 Nancy 在尝试创建 BaseModule 的实例时抛出异常,因为它是泛型类型
我们如何避免这种情况?
@ndphuong我没有检查过这个,但你可以尝试覆盖模块注册来指定你真正想要注册的模块:
protected override IEnumerable<ModuleRegistration> Modules
{
get
{
return base.Modules.Where(m => m.ModuleType == typeof(GenericBase<YourType>));
}
}
使您的通用模块abstract
很棒的提示@thecodejunkie
最有用的评论
使您的通用模块
abstract