mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
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:
@@ -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); }
|
||||
|
Reference in New Issue
Block a user