简体   繁体   English

展示模型

[英]Presentation Model

I want to set values for form labels from the controller. 我想从控制器设置表单标签的值。 Can I send List<String> as parameter and have the form to set individual labels OR set the values for each and every labels from controller class?. 是否可以将List <String>作为参数发送,并具有设置单个标签的形式或为控制器类中每个标签设置值的形式? I am confused with the level of extracting the logic from the form. 我对从表单中提取逻辑的级别感到困惑。

i assume you use Presentation Model pattern (no matter what UI Framework you use). 我假设您使用Presentation Model模式(无论您使用哪种UI框架)。

you can make all of your form label as a single Property (of course with a notification ability) on your Presentation Model and bind it with the Form Label in the view. 您可以在Presentation Model上将所有表单标签作为一个属性(当然具有通知功能),并将其与视图中的Form Label绑定。

If you passing List it would less natural, harder to read and require more code on unit testing. 如果您通过List,它将变得不那么自然,更难阅读,并且需要更多的单元测试代码。

BUT Form label is View-Specific it will deal with localization or internationalization it would be better to just put it on the view not in the Presentation-Model 但是表单标签是特定于视图的,它将处理本地化或国际化,最好将其放在视图中,而不是在Presentation-Model中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM