entity framework - Ef 6 RemoveRange in Linq -
iqueryable<portservicestariffdetail> detalis = _context.portservicestariffdetails .where(w => w.portservicestariffid == tariffid && w.portservicestariffdetailid == detailid); if (detalis.count() > 0) { var mydetial = detalis.groupby(g => new { g.startrate,g.endrate }).asqueryable(); _context.portservicestariffdetails.removerange(mydetial.asqueryable()); _context.savechanges(); }
depends on start , end rate remove range, have raise issue anonymous type. can do???
argument 1: cannot convert 'system.linq.iqueryable>' 'system.collections.generic.ienumerable'
try this
foreach(var x in mydetial) { _context.portservicestariffdetails.removerange(x.tolist()); } _context.savechanges();
but don't understand why you're grouping remove it?
Comments
Post a Comment