Fix issue with BaseViewModel override

When the main view doesn't use a BaseViewModel class, we create an
AdaptedViewModel for the layout and document. However, we don't want
to "Eval" the various properties to the original ViewModel to avoid
conflicting rendering of zones.

--HG--
branch : dev
This commit is contained in:
rpaquay@microsoft.com
2010-03-11 15:55:26 -08:00
parent 2943b7887e
commit 69312b625d

View File

@@ -42,11 +42,15 @@ namespace Orchard.Mvc.ViewModels {
public TProperty Value {
get {
if (_value == null && _builder != null) {
_value = _original.Eval(_expression) as TProperty;
if (_value == null)
object temp;
if (_original.TryGetValue(_expression, out temp) &&
temp is TProperty) {
SetValue(temp as TProperty);
}
else {
SetValue(_builder());
}
}
return _value;
}
set { SetValue(value); }