Csla.Xaml.ViewModel<T> - Overloads inconsistently marked as virtual

Csla.Xaml.ViewModel<T> - Overloads inconsistently marked as virtual

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


Jaans posted on Sunday, January 30, 2011

Hi all

We have our own ViewModelCore base class that inherits from Csla.Xaml.ViewModel<T> and overrides and adds a couple of behaviours that we need.

A specific example is the BeginRefresh overloads on Csla.Xaml.ViewModel<T>.

We started doing this since 3.8.4, and CSLA 4 added a valuable overload to enable the use of a Lambda functions as parameters, thus reducing the use of "Magic" strings (that can go stale and is only picked up at runtime).

I discovered that with our conversion to CSLA 4, we could not override this newly added overload (because it's not marked virtual).

Is this an omission or intentional on the part of CSLA?

Ps: Upon glancing at the source code, it would seem that there are other methods that suffer the same inconsistency (e.g. DoRefresh)

Thanks,
Jaans

RockfordLhotka replied on Sunday, January 30, 2011

The new methods invoke the old methods (iirc). The new methods just reflect to find the method name, then invoke the string-based methods that are virtual. So it would be counter-productive to make them all virtual, unless you've got a specific scenario?

Jaans replied on Sunday, January 30, 2011

Hi Rocky

I thought I was about to eat my shorts, BUT interestingly enough the overloads in my derived class just do not get called when using the new CSLA 4 Lambda based overload.

Could this be some weird C# inheritance vs. Lambda thingy ?

Jaans replied on Tuesday, February 01, 2011

*bump*

RockfordLhotka replied on Tuesday, February 01, 2011

http://www.lhotka.net/cslabugs/edit_bug.aspx?id=894

Jaans replied on Tuesday, February 01, 2011

Thanks!

Copyright (c) Marimer LLC