ViewModelBase : Add some extensibility points

ViewModelBase : Add some extensibility points

Old forum URL: forums.lhotka.net/forums/t/8777.aspx


edore posted on Wednesday, April 07, 2010

Hello,

I based our MVVM architecture by derivating on this base class and I'm pretty happy with the results.  Down the road I encountered a case for which I would like a different behaviour in QueryCompleted.  In fact, I want to get a hold on the model before it it assigned to the Model property.  Here's my proposition : add a virtual method called OnRefreshing() which we could override in our sub class.  Here's an example of what I seek : 

private void QueryCompleted(object sender, EventArgse) false;

{

IsBusy = 

 

var eventArgs = (IDataPortalResult)e; 

 if (eventArgs.Error == null ) 

{

 

var model = (T)eventArgs.Object;

OnRefreshing(model);

Model = model;

}

var model = (T)eventArgs.Object;

OnRefreshing(model);

Model = model;

}

 

 

else

{

Error = eventArgs.Error;

OnRefreshed();

}

}

And as a general rule, it would be nice to introduce more of these : On...ing() and On...ed() virtual methods to enable us to "insert" code without altering Csla...

 

Thanks!

RockfordLhotka replied on Wednesday, April 07, 2010

I'll add this to the wish list, it is a good idea.

Copyright (c) Marimer LLC