Yes, it seems to be working now as expected, so when I attaching entity with cleared references, no cascading delete operation occures, in other words it doesn't affect relations of dbEntity and simply updates fields .
Here is code I have now:
(var model =
var currentDbEntity = model.Entities.Single(t => t.EntityId == updatedEntity.EntityId);
//update reference changes...
UpdateRoles(model, updatedEntity, currentDbEntity);
where UpdateRoles is :
UpdateRoles(ArchivariusModel model, Entity entity, Entity dbEntity)
var updatedRoles = entity.EntityRoles.ToArray();
var currentRoles = dbEntity.EntityRoles.ToArray();
var rolesToDeleteId = currentRoles.Except(updatedRoles).ToArray();
model.EntityRoles.Single(t => t.EntityRoleId == updatedRole.EntityRoleId));
So, am I rigth that in this situation and similiar situations related to references update it is unavoidable to request database?
Because of deserialization it doesn't handle back references, say from EntityRole to Entities (entityRole.Entities), right, so in order to handle it properly I have to quesry db... It is very important question for me from performance perspectives, because I'm using Sqlite, so it is not very cool to have db accesses while it could be avoided...
Nonetheless, thank you so much for your help!