Skip to content

Commit 9b75b4b

Browse files
Update Extensions/Xtensive.Orm.BulkOperations/BulkExtensions.cs
Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
1 parent 5e005e0 commit 9b75b4b

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Extensions/Xtensive.Orm.BulkOperations/BulkExtensions.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ public static IUpdatable<T> Set<T, TResult>(this IUpdatable<T> query, Expression
7878
/// <returns>Instance of <see cref=" IUpdatable&lt;T&gt;"/>.</returns>
7979
[Pure]
8080
public static IUpdatable<T> Set<T, TResult>(this IQueryable<T> query, Expression<Func<T, TResult>> field,
81-
TResult value) where T: IEntity =>
82-
Set(query,
83-
field,
84-
Expression.Lambda<Func<T, TResult>>(Expression.Constant(value, typeof(TResult)), Expression.Parameter(typeof(T), "a")) // Manually constructed expression is simpler than `a => value`
85-
);
81+
TResult value) where T: IEntity
82+
{
83+
// Manually constructed expression is simpler than `a => value`
84+
var valueFunc = Expression.Lambda<Func<T, TResult>>(Expression.Constant(value, typeof(TResult)),
85+
Expression.Parameter(typeof(T), "a"));
86+
87+
return Set(query, field, valueFunc);
88+
}
8689

8790
/// <summary>
8891
/// Executes bulk update of entities specified by the query.

0 commit comments

Comments
 (0)