This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Is it possible to mass remove Entities using the .Remove based on a subquery using the .IN from a list of IDs from another table? I tried the following, it doesn't give me an error, but it doesn't delete the records in the Contacts table. Any suggestions on what I am doing wrong or if this is even possible?
Query removedCorpIDs = new Query(typeof(CorporationsMailGroup), Entity.Attribute("ImportGroupID") == theID); removedCorpIDs.Projection.Add("CorpID"); // Doesn't Work! Query theRemoveQuery = new Query(typeof(Contact), Entity.Attribute("CorpID").In(removedCorpIDs)); uow.Remove(theRemoveQuery); uow.SaveChanges(); Thank you.
|
|
|
Yes - this should be fine. Have you looked at the SQL which is being generated for this query by attaching a logger to the UnitOfWork.Context and does that look correct according to what you have specified?
Jeremy |
|