1
2
我通常创建一个完全不了解实体框架的表示模型类型,并将其投射到实体框架中。所以我会这样做:
这看起来有很多工作吗?考虑优点:
|
2
0
我还建议使用视图模型。当应用程序增长时,特定视图上可能会有更多内容,例如:
您可以像存储库一样在控制器和数据抽象之间添加另一层,因为您的BL应该决定什么是“mostrated”文章。如果在多个视图上使用“mostrated”日志,则不希望在多个控制器中写入相同的查询。对于存储库,控制器代码可能如下所示:
希望,这有帮助。 |