【问题标题】:autofac open generic iRepository<T> xml configurationautofac 打开通用 iRepository<T> xml 配置
【发布时间】:2012-12-04 18:45:52
【问题描述】:

我想使用 autofac 和存储库模式 (iRepository),但似乎看不到使用 XML 配置配置 autofac 的方法。

其他人也遇到过这个问题吗?

【问题讨论】:

  • 我可以使用开放泛型 code.google.com/p/autofac/wiki/OpenGenerics 中的示例并使用构建器使其工作,我想知道是否也可以使用开放泛型启用 xml 配置,团队希望成为能够有这个要求。如果不可能,我们将为每个上下文/类型创建接口并继续。

标签: c# autofac xml-configuration open-generics


【解决方案1】:

Autofac 目前不支持通过 XML 配置注册开放的泛型。 XML 配置机制很方便,但不是 Autofac 的完整 1:1 功能集(可能永远不会)。

处理更复杂配置的推荐方法是将XML configurationAutofac modules 结合使用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多