score:1

Accepted answer
int userid = ...
using (var dbcontext = new mydbcontext())
{
    dbcontext.removeuser(userid);
}

score:1

var customobjectqueryable = _context.users.where(x => x.id == request.userid);

var entity = customobjectqueryable
        .include(x => x.notificationscreated)
        .include(x => x.uservisibility)
        .first();

var entry = _context.entry(entity);

entry.collection(x => x => x.usersmeetings).load();
entry.collection(x => x.usersgroups).load();
entry.collection(x => x.roles).load();
entry.collection(x => x.refreshtokens).load();
entry.collection(x => x.groups).load();
entry.collection(x => x.notifications).load();
entry.collection(x => x.meetings).load();

entity.usersmeetings.clear();
entity.usersgroups.clear();
entity.roles.clear();
entity.refreshtokens.clear();
entity.group.clear();
entity.notifications.clear();
entity.meetings.clear();

_context.savechanges();

Related Query

More Query from same tag