Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8836

mass delete/update objects without having to retrieve them first?

$
0
0
Is there some way in the Kentico API to mass delete/update objects without having to retrieve them first?Similar to how EntityFramework Extended works?Example DeleteUserInfoProvider.DeleteUsers().Where(x =@ x.UserEnabled == true); This would build a SQL DELETE statement under the hood without any SELECT required?Example Updatevar userInforPartial = new UserInfo { UserEnabled = false }; UserInfoProvider.UpdateUsers(userInfoPartial).Where(x =@ x.UserIsHidden == true); This would craft an UPDATE SQL statement to disable all hidden users.Trevor: Your answer below still relies on making SELECT calls to the database before iterating the collection of retrieved objects. I'm looking for a way of telling Kentico to create UPDATE/DELETE SQL commands without having to retrieve the relevant object first.In many cases, you just need to set a value on multiple records ... you know the record ID's and the value you want to set, so why add the extra overhead of a SELECT followed by an UPDATE when you could just do a straight UPDATE X SET Y=Z WHERE ID IN (1,2,3,4).

Viewing all articles
Browse latest Browse all 8836

Trending Articles