Hi,@Ning Zhu. Welcome to Microsoft Q&A.
As the compilation error message describes, your second way of writing will be ambiguous.
SetProperty
has overloaded methods.
.SetProperty<TProperty>(Func<TSource, TProperty>, Func<TSource, TProperty>)
.SetProperty<TProperty>(Func<TSource, TProperty>, TProperty)
null
could be assigned to both Func<TSource, TProperty>
and TProperty
. The compiler cannot identify which function to execute, so it reports an error of CS0121.
As described in the CS0121 document, forced conversion could solve this problem.
indexDB.TabeABC
.Where(b => b.PropertyABC != null)
.ExecuteUpdate(setters => setters.SetProperty(b => b.PropertyABC, (string)null));
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.