Working on
This commit is contained in:
@@ -329,35 +329,7 @@ namespace Umbraco.Web.Models
|
||||
// can handle properties only when using the proper casing. So what this
|
||||
// does is ensure that any casing is supported.
|
||||
|
||||
Func<string, Attempt<object>> getMember =
|
||||
memberAlias =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return Attempt<object>.Succeed(
|
||||
content.GetType().InvokeMember(memberAlias,
|
||||
System.Reflection.BindingFlags.GetProperty |
|
||||
System.Reflection.BindingFlags.Instance |
|
||||
System.Reflection.BindingFlags.Public,
|
||||
null,
|
||||
content,
|
||||
null));
|
||||
}
|
||||
catch (MissingMethodException ex)
|
||||
{
|
||||
return Attempt<object>.Fail(ex);
|
||||
}
|
||||
};
|
||||
|
||||
//try with the current casing
|
||||
var attempt = getMember(alias);
|
||||
if (!attempt.Success)
|
||||
{
|
||||
//if we cannot get with the current alias, try changing it's case
|
||||
attempt = alias[0].IsUpperCase()
|
||||
? getMember(alias.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.CamelCase))
|
||||
: getMember(alias.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.PascalCase));
|
||||
}
|
||||
var attempt = content.GetType().GetMemberIgnoreCase(content, alias);
|
||||
|
||||
return !attempt.Success
|
||||
? null
|
||||
|
||||
Reference in New Issue
Block a user