Hello, I have the following codes.
using (var dbContext = GetDbContext())
{
dbContext.Set<TEntity>().Attach(entity);
dbContext.Entry(entity).State = EntityState.Modified;
try
{
dbContext.SaveChanges();
return true;
}
catch (DbUpdateConcurrencyException dbEx)
{
// Handling exception
return false;
}
}
Based on your sharing, I already know how to Mock Attach the method, but there is no handling for setting the dbContext.Entry(entity).State property. Can you give me a suggestion?
Hello, I have the following codes.
Based on your sharing, I already know how to Mock
Attachthe method, but there is no handling for setting thedbContext.Entry(entity).Stateproperty. Can you give me a suggestion?