Quantcast
Channel: URF - Unit of Work & (extensible/generic) Repositories Framework
Viewing all articles
Browse latest Browse all 1539

New Post: Update record ... except one field

$
0
0
You have two employees with the same Primary Key in the Context. Update all the properties
private void Update(Employee employee)
{
    var e = _repoEmployee.GetById(employee.Id);
    
    _unitOfWorkAsync.BeginTransaction();
    
    e.FirstName = employee.FirstName;
    e.LastName = employee.LastName;ZZ
    _repoEmployee.Update(e);

    _unitOfWorkAsync.SaveChanges();
    _unitOfWorkAsync.Commit();
}

Viewing all articles
Browse latest Browse all 1539

Trending Articles