I'm using EF/Automapping. An error occurs with a Foreign Key. With a try...catch, I want to catch the error. And I want to go further by inserting / updating data.
But I have the idea the process stays in the same exception. It looks the same as LINQ-to-SQL. That the SaveChanges-method try to save all updates who are waiting in the stack for saving.
Is it possible to clear a save-process?
The Insert-method in the LogMessagesService
public int Insert(LogBerichtDto LogBerichtDto)
{
LogBericht entity = _mapper.Map<LogBerichtDto, LogBericht>(LogBerichtDto);
_logBerichtRepository.Insert(entity);
_logBerichtRepository.Save();
return entity.Id;
}
In GenericRepository
public void Save()
{
_context.SaveChanges();
}