NopCommerce 1.90 中的实体框架 4.0 更改
为了学习 EF,我需要一个很好的例子,然后我通过 google 找到了 NopCommerce。我喜欢他们在 1.80 版本中对 EF 的实现及其架构。
1.80 版本中的实体框架架构给我留下了深刻的印象。我喜欢创建 AspNetObjectContextManager
并为请求访问相同的 objectContext
的方式。
但是现在,当我下载 nopcommerce 1.90 时,我看到所有类 AspNetOCM
、ObjectContextHelper
、ObjectContextManager
等都被删除,并且上下文被添加到服务类(例如CustomerService
)。
我能知道背后的原因吗?1.80版本的实体框架架构是否有任何缺点?
我担心的原因是我不想学习有一些缺点的架构。我知道 NopCommerce 开发团队在编码中始终保持高水平,但我很想知道从 1.90 版本中删除这些类的原因
For learning EF, I was after a good example and I reached NopCommerce via google. I loved their implementation of EF and it's architecture in version 1.80.
I was very impressed with the Entity Framework Architecture in version 1.80. I liked the way of creating AspNetObjectContextManager
and accessing the same objectContext
for the request.
But now when I downloaded nopcommerce 1.90, I see all the classes AspNetOCM
, ObjectContextHelper
, ObjectContextManager
, etc.. are removed and context is added to the Service classes (e.g. CustomerService
).
Can I please know the reason behind it and if there are any shortcoming in the version 1.80's Entity Framework Architecture.
The reason I am concerned is that I don't want to learn the architecture with some shortcomings. I know NopCommerce development team have always maintained high level of quality in their coding, but I would love to know the reason behind removing the classes from version 1.90
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这个变化与1.90中引入IoC/DI(控制反转/依赖注入)模式有关。
此模式使您能够在配置文件中设置服务接口实现(例如,ICustomerService 的 MyCustomerService),这有助于客户端和服务实现之间的松散耦合。
不过我从未尝试过 NopCommerce 1.80,所以无法说出其架构的缺点是什么。
I think this change relates to introduction of IoC/DI (inversion of control / dependency injection) pattern in 1.90.
This pattern enables you to set a service interface implementation (e.g. MyCustomerService for ICustomerService) in a config file, which contributes to loose coupling between client and service implementation(s).
However I've never tried NopCommerce 1.80, so can't tell what were the disadvantages of its architecture.