【发布时间】:2010-09-09 18:02:22
【问题描述】:
在学习和开发 Asp.Net MVC 应用程序时,我想知道在 MVC 中编写 Business Logic 和 Data Access logic 的更好地方是什么。
三层之间的DataAccess和Business Logic应该写在哪里(Model, View and Controller)??
谁能告诉我编写代码的正确方法。
场景:我想retrieve all the employees where employee name like 'Mi%'(我有SQL procedure to execute and retrieve the data.)
PS:想知道我应该在哪里创建业务逻辑类的实例以及我应该在哪里创建数据访问层类的实例?
提前致谢。
【问题讨论】:
-
请务必查看NerdDinner tutorial.
-
查看用于创建 BL 和 DAO 对象的 IoC 模式,Steven Sanderson 在他的《Pro ASP.NET MVC 框架》一书中很好地涵盖了这个主题,或者尝试谷歌搜索“asp.net mvc ioc”