Entity Framework 4.0 を使用しています。SaveChanges()
0 を返すが、例外をスローしない可能性はありますか? たとえば、追加した後。
これが私のコードです:
try
{
_context.CodeProducts.Add(entity);
_context.SaveChanges();
//Shell I control return result from SaveChanges() in here.
//However doesn't throw an exceoption?
return new MethodResponse()
{
ResultText = "Successful",
Type = MethodResponse.ResponseType.Succeed
};
}
catch (OptimisticConcurrencyException exc)
{
throw exc;
}
catch (UpdateException exc)
{
throw exc;
}
catch (Exception exc)
{
throw exc;
}