Is it possible to define error message for UNIQUE KEY constraint in SQL SERVER when it is called by EF 4.0?
问题 I don't need to execute duplicatation query like checking some column is unique or not because this operation always execute with SQL Server constraint. However, default error message from SQL Server is not well-defined for end-user. Do you have any idea for change/redefine error message to be more user-friendly? PS. I execute all query via Entity Framework 4.0. 回答1: The only way I know to do this is to catch SqlException and then check the Number property. This property is a short-cut to the