简体   繁体   中英

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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