gpt4 book ai didi

How to set null in update with ef core 7 ExecuteUpdateAsync SetProperty(如何使用ef core 7 ExecuteUpdateAsync SetProperty在更新中设置NULL)

转载 作者:bug小助手 更新时间:2023-10-27 21:08:48 32 4
gpt4 key购买 nike



I have this method:

我有这样一个方法:


public async Task<int> RemoveClassify(RemoveClassifyVm vm)
{
return await _db.UserAccesses
.Where(UserAccess => vm.userAccessIds.Any(userAccessId => userAccessId == UserAccess.Id))
.ExecuteUpdateAsync(UserAccess => UserAccess
.SetProperty(UserAccess => UserAccess.ClassId, null)
);
}

but get error : Error CS0121 The call is ambiguous between the following methods or properties: 'SetPropertyCalls.SetProperty(Func<TSource, TProperty>, Func<TSource, TProperty>)' and 'SetPropertyCalls.SetProperty(Func<TSource, TProperty>, TProperty)'

但Get Error:Error CS0121该调用在以下方法或属性之间不明确:‘SetPropertyCalls.SetProperty(Func ,Func )’和‘SetPropertyCalls.SetProperty(Func ,TProperty)’


更多回答
优秀答案推荐

we must use : SetProperty(UserAccess => UserAccess.ClassId, (int?)null)

必须使用:SetProperty(UserAccess=>UserAccess.ClassID,(int?)NULL)



Use this:

使用以下命令:


SetProperty(UserAccess => UserAccess.ClassId, UserAccess => null)

更多回答

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com