c# - Why aren't we getting the same instance of the CustomerViewModel? -


we're using mvvm light. have make multiple instances of same small collection of classes: customerviewmodel, productviewmodel , ordersviewmodel. in effort make sure we're invoking same instance of of classes create guid , associated each instance of of 3 classes. our first time using mvvm light. our understanding mvvm light use singleton pattern each time invoke calls getinstance specifying particular instance. in order assure we're calling same 1 pass in guid associated particular class earlier. , yet failing of time.

we've been trashing away @ 3 weeks , no closer getting solved.

i've set breakpoints in constructor of customer class see guid is:

public customerviewmodel() {    refreshlist();    availablefields = typeof(customer).getproperties().select(a => a.name).tolist<string>(); } 

i'll set breakpoint on refreshlist(). (our refreshlist() method used fetch data displayed in data grid in view.) can see class's name customerviewmodel.

but later when we're trying navigate customer detail viewmodel, invokes should same instance of customerviewmodel in case:

public static customerviewmodel getcustomersbyid(string id) {     return servicelocator.current.getinstance<customerviewmodel>(id); } 

this code in viewmodellocator. i've set breakpoint on return statement , checked value of id, should equal guid create. never is. why not? doing wrong?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -