Skip to content

Commit

Permalink
#7469 - Fixed Ambiguous extension method issue by renaming our extens…
Browse files Browse the repository at this point in the history
…ion method from Value to GetValue
  • Loading branch information
bergmania committed Jan 17, 2020
1 parent 6637bf5 commit baef282
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ public static class PublishedElementExtensions
/// <summary>
/// Gets the value of a property.
/// </summary>
public static TValue GetValue<TModel, TValue>(this TModel model, Expression<Func<TModel, TValue>> property, string culture = null, string segment = null, Fallback fallback = default, TValue defaultValue = default)
public static TValue ValueByExpression<TModel, TValue>(this TModel model, Expression<Func<TModel, TValue>> property, string culture = null, string segment = null, Fallback fallback = default, TValue defaultValue = default)
where TModel : IPublishedElement
{
var alias = GetAlias(model, property);
return model.Value<TValue>(alias, culture, segment, fallback, defaultValue);
}

//This cannot be public due to ambiguous issue with external ModelsBuilder if we do not rename.
private static string GetAlias<TModel, TValue>(TModel model, Expression<Func<TModel, TValue>> property)
{
if (property.NodeType != ExpressionType.Lambda)
Expand Down

0 comments on commit baef282

Please sign in to comment.