当我应该从数据库在我看来,ASP.NET MVC查询 [英] When should I query from a database in my view, ASP.NET MVC
本文介绍了当我应该从数据库在我看来,ASP.NET MVC查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题:
如果我有一个场景,我不想改变我的模特属性,需要从一些表中获得多一个属性,就是它,如果罚款我写了一个视图内查询并显示结果?
If I have a scenario where I don't want to change my model properties and need to get one more attribute from some table, is it fine if I write a query inside a view and show the result?
如果答案是否定的,我想知道为什么它不认为是一个很好的方式。
If the answer is no, I would like to know why it's not considered a good way.
推荐答案
是
查看是不是你的数据结构的一面镜子。其实,往往是一个
聚集和/或操纵用户友好的 presentation 的那个站在背后的数据。
View is not a mirror of your data structure. Actually, often it's an aggregation and/or manipulation for user-friendly presentation of the data that stands behind.
这篇关于当我应该从数据库在我看来,ASP.NET MVC查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文