简体   繁体   English

如何用asp.net mvc 声明模式?

[英]How to state pattern with asp.net mvc?

One question but I'm looking for two solutions:一个问题,但我正在寻找两种解决方案:

  • static静止的
  • dynamic动态的

Static means I know all states.静态意味着我知道所有状态。 Dynamic means I don't know states because end user can define it.动态意味着我不知道状态,因为最终用户可以定义它。

Static静止的
How to create and organize views, viewmodels and actions?如何创建和组织视图、视图模型和动作? I know that state pattern is well suited for that scenario but how to pass data from view models and put them to entity?我知道状态模式非常适合该场景,但是如何从视图模型传递数据并将它们放入实体? Each action is responsible for one state?每个动作负责一个状态? What if I have view with more than one possible choices of next state?如果我对下一状态有多个可能的选择怎么办?

How I should choose proper action for state sent as a string by posting some value?我应该如何通过发布一些值来为作为字符串发送的状态选择正确的操作?

How to match properly posted data to specific actions on entity (look at state pattern)?如何将正确发布的数据与实体上的特定操作匹配(查看状态模式)?

Dynamic动态的
What if end user can create own states?如果最终用户可以创建自己的状态怎么办? Example: app has something like workflow.示例:应用程序具有类似工作流的功能。 Suppose I have the same situation like above.假设我有和上面一样的情况。 I haven't views for each state because I don't know them.我没有对每个州的看法,因为我不了解它们。

Questions... are the same but I think solution may be different... but what is the solution?问题......是相同的,但我认为解决方案可能不同......但解决方案是什么?

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

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