.net - Injection of ViewModels without a Service Locator -
i think service locator anti-pattern, find common see "viewmodellocator" each view takes datasource in xaml-based applications.
how avoided?
you can use mvvm framework uses conventions, caliburn.micro. in caliburn, register viewmodel di container when app starts. when have testview automatically bound testviewmodel (convention name, framework looks viewmodel in di container, gets/creates instance , binds it.).
Comments
Post a Comment