I am new to WPF. I'm trying to write a program that makes use of the MVVM design pattern.
My program has a list of countries that are fetched from the database on startup, and are static after that. Where is the place to put these? At the moment, I have them sitting at the top level of my ViewModel class hierarchy:
abstract class AbstractViewModel { static Jurisdiction[] jurisdictionOptions; public Jurisdiction[] JurisdictionOptions { get { if (jurisdictionOptions == null) { using (var db = new DatabaseContext()) { jurisdictionOptions = db.Jurisdictions.ToArray(); } } return jurisdictionOptions; } } } I can then set the ItemSource of UIElements to JurisdictionOptions.
Is this the correct way of implenting this?