Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/CommonFramework/ExpressionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,24 @@
public Expression<Action<TSource, TProperty>> ToSetLambdaExpression()
{
return path.GetProperty().ToSetLambdaExpression<TSource, TProperty>();
}
}

public Func<TSource, TProperty> ToGetFunc()
{
return path.GetProperty().GetGetValueFunc<TSource, TProperty>();
}

public Action<TSource, TProperty> ToSetAction()
{
return path.GetProperty().GetSetValueAction<TSource, TProperty>();
}

public Action<TSource, TProperty> ToLazySetAction()
{
Lazy<Action<TSource, TProperty>> lazySet = new(path.ToSetAction);

return (source, value) => lazySet.Value(source, value);
}

public Expression<Func<TNextSource, TProperty>> OverrideInput<TNextSource>(Expression<Func<TNextSource, TSource>> expr1)
{
Expand Down Expand Up @@ -274,7 +291,7 @@

var startExpr = memberChains.Last();

constExpr = startExpr.Expression as ConstantExpression;

Check warning on line 294 in src/CommonFramework/ExpressionExtensions.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
if (constExpr == null)
{
return constExpr;
Expand Down
2 changes: 1 addition & 1 deletion src/CommonFramework/PropertyAccessors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public record PropertyAccessors<TSource, TProperty>(
{
public PropertyAccessors(
Expression<Func<TSource, TProperty>> path)
: this(path, path.Compile(), path.ToSetLambdaExpression().Compile())
: this(path, path.ToGetFunc(), path.ToLazySetAction())
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[assembly: AssemblyProduct("CommonFramework")]
[assembly: AssemblyCompany("IvAt")]

[assembly: AssemblyVersion("2.1.13.0")]
[assembly: AssemblyVersion("2.1.14.0")]
[assembly: AssemblyInformationalVersion("changes at build")]

#if DEBUG
Expand Down
Loading