6

[Disclaimer: I come from frontend, react/angular world where i use redux/ngrx for state management.]

Is there some standard way of managing application state in WPF applications?

I’ve seen some use of built in commands. On the other hand, i’ve seen Redux.NET library.

For one of the projects i need to make a decision on app state management and i’d like to go with some standard way.

So, is there a single standard way or maybe a list of 3 most used?

dee zg
  • 13,793
  • 10
  • 42
  • 82
  • Have you had a look at this yet [Is there a good formal pattern to manage state in MVVM?](https://softwareengineering.stackexchange.com/questions/316931/is-there-a-good-formal-pattern-to-manage-state-in-mvvm) – Tronald Dec 12 '19 at 20:34
  • @Tronald yes, i have. thats one of the first one i’ve found in my search but i didnt understand/couldnt tell if its a standard way or not? – dee zg Dec 12 '19 at 21:19
  • The answer is no, not really. Windows apps are inherently state-full. So your state is often right there in memory whilst you're sending updates to the database directly or via service. You're on a wan so rarely not connected rather than occasionally connected. A common pattern is a single window app which has a viewmodel orchestrates models. If you have more views then an ioc container is often used as a mediator. To persist state across sessions either the central database is used or appdata roaming. Data/ model classes can be serialised to disk in appdata. – Andy Dec 13 '19 at 17:30
  • 4
    @Andy thanks for your response! what about the case if you have, for example, logged user details object and you need it across many views? are you saying that for each view you want to go to local db to grab it whenever that view is initialized? if not, then i guess the question still stands like: how is the state represented in memory? and consequently, if any change occur (user changes his phoneNumber for example) how do you change it in state object? should redux pattern be followed or something else? or are you saying it should be kept in topmost view (window) and propagated to children? – dee zg Dec 13 '19 at 20:04

0 Answers0