元组更换的ViewModels [英] Replacing ViewModels with Tuples
问题描述
我刚开始对目前包含了公平几个视图模型DTO类新项目。
I've just started on a new project which currently contains a fair few ViewModel DTO classes.
我不知道这是否将是有益的,甚至好的做法元组代替许多的DTO和使用,作为我转流一堆的对象,以我的观点的方法。
I'm wondering whether it would be useful and even good practice to replace many of these DTOs with Tuples and to use that as my method of transfering a bunch of objects to my views.
你觉得呢?这是元组的正确用法还是我在这里下车的标志?
What do you think? Is this a correct usage of the tuple or am I off the mark here?
推荐答案
通常查看模型与之相关的元数据哪些其他中,您可以执行验证,并与编辑/显示模板集成。元组似乎并不合适。另一个缺点是他们的前preSS在视图模型(每个属性显然少的目的 Model.Item1
, Model.Item2
,...,没有其他人比原来的开发人员可以使这个任何意义,如果他喜欢我几天后,连他将不能够有意义)。
Usually view models have metadata associated with them which among other allows you to perform validation and integrates with editor/display templates. Tuples don't seem appropriate. Another disadvantage is that they express less clearly the purpose of each property in the view model (Model.Item1
, Model.Item2
, ..., no-one else than the original developer can make any sense of this, and if he is like me after few days even he won't be able to make sense).
这篇关于元组更换的ViewModels的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!