mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Adding a default value setter for Infoset
This commit is contained in:
@@ -9,6 +9,7 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
public static TProperty Retrieve<TPart, TProperty>(this TPart contentPart,
|
||||
Expression<Func<TPart, TProperty>> targetExpression,
|
||||
TProperty defaultValue = default(TProperty),
|
||||
bool versioned = false) where TPart : ContentPart {
|
||||
|
||||
var propertyInfo = ReflectionHelper<TPart>.GetPropertyInfo(targetExpression);
|
||||
@@ -19,7 +20,7 @@ namespace Orchard.ContentManagement {
|
||||
? null
|
||||
: (versioned ? infosetPart.VersionInfoset.Element : infosetPart.Infoset.Element)
|
||||
.Element(contentPart.GetType().Name);
|
||||
return el == null ? default(TProperty) : el.Attr<TProperty>(name);
|
||||
return el == null ? defaultValue : el.Attr<TProperty>(name);
|
||||
}
|
||||
|
||||
public static TProperty Retrieve<TProperty>(this ContentPart contentPart, string name,
|
||||
|
||||
Reference in New Issue
Block a user