In my latest WPF applications I've been using a Singleton class, that I call Model, to contain all my application's logic, such as file reading, information handling, etc..In the WPF Views or Windows I just call the methods that I need, when I need them: Model.Instance.GetProducts(string category); Besides having always the same instance, I find this convenient because I can call any method that I want in any window, and I can define the Model in App.xaml to be a StaticResource and then do the bindings that I need. For example, set the Binding of a DataGrid to an ObservableCollection present in the Model.What do you think of this approach? A few years ago at college, when working with Windows Forms we used to work with the MVC pattern, where the controller would contain some events that called methods from the Model, and those events would later be invoked by the Views.
How much trouble can the use of Singleton class as Model cause?
c#;design patterns;programming practices;code quality;organization
God object is one of the worst designs you can create. Please, put some effort into separating different concerns. Your future self will thank you.