|
4
|
| mxmissile · 技术社区 · 16 年前 |
|
|
1
1
您应该使用工厂方法注册ISession。 另一个选择(并非总是最好的,但易于使用)是: 实现ISession和ISessionFactory接口(SessionProxy和SessionFactoryProxy)。
通过这种方式,您可以只注册ISession(由SessionAggregator实现)和ISessionFactory(SessionFactoryAggregator),任何DI框架都可以轻松地解析ISession。
我已经将这些实现添加到我的Commons assembly中,所以我不应该每次都重新实现它。 编辑: 现在,要在web应用程序中使用ISession:
|
|
|
2
0
This 问题及;答案可能会帮助你。 一种方法-从中窃取nhibernate会话管理 "S#arp Architecture" |
|
|
Navid K · 与StructureMap 4.6瞬态生命周期混淆 8 年前 |
|
|
ViqMontana · 如何使用结构图模拟基类? 8 年前 |
|
|
chapas · 注入到不同的项目/程序集中 9 年前 |
|
|
Morn · 构造函数依赖注入WebApi属性 11 年前 |
|
|
Martin R-L · 可以使用约定注入基于ctor参数名称的命名实例吗? 13 年前 |