将实例化类传递给温莎城堡派生的具体类
我有一个系统,我用它来测试一些新的架构。我有以下设置(在 MVC2 .Net - C Sharp 中)
:控制器<服务<存储库< DB
我使用 Castle Windsor 作为我的 DI (IoC) 控制器,这在 Service 和 Repo 层中都工作得很好。但是,我现在想要将实体框架(DatabaseNameEntity)传递给服务的构造函数,然后传递给存储库,以便我有类似于每个请求的工作单元模式的东西(这感觉就像我想要实现的目标) - 而且我很难弄清楚如何使用温莎城堡来实现这一点。
我是不是离题了?任何指示表示赞赏。
I have a system that I'm using to test some new architecture. I have the following setup (In MVC2 .Net - C Sharp):
View < Controller < Service < Repository < DB
I'm using Castle Windsor as my DI (IoC) controller, and this is working just fine in both the Service and Repo layers. However, I'm now at a point where I would like to pass an Entity Framework (DatabaseNameEntity) to the constructor to the Service, and then to the Repo, so that I have something similar to a Unit of Work pattern per request (This feels like what I'm trying to achieve anyway) - and I'm having trouble working out how this can be done using Castle Windsor.
Am I going off on a silly tangent? Any pointers appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你想如何通过它?从呼叫站点?
为此使用类型化工厂设施。
How would you like to pass that? From the call site?
Use Typed Factory Facility for that.