Update: DbEntityValidationException Detailed Logs
This commit is contained in:
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0509.1618")]
|
||||
[assembly: AssemblyFileVersion("1.2.0509.1618")]
|
||||
[assembly: AssemblyVersion("1.2.0513.1327")]
|
||||
[assembly: AssemblyFileVersion("1.2.0513.1327")]
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyFileVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyVersion("1.2.0513.1327")]
|
||||
[assembly: AssemblyFileVersion("1.2.0513.1327")]
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyFileVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyVersion("1.2.0513.1327")]
|
||||
[assembly: AssemblyFileVersion("1.2.0513.1327")]
|
||||
@@ -44,13 +44,33 @@ namespace Disco.Services.Logging
|
||||
}
|
||||
public static void LogException(string Component, Exception ex)
|
||||
{
|
||||
if (ex.InnerException != null)
|
||||
// Handle Special-Case Errors
|
||||
if (ex is System.Data.Entity.Validation.DbEntityValidationException)
|
||||
{
|
||||
Log(EventTypeIds.ExceptionWithInner, Component, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
|
||||
var dbException = (System.Data.Entity.Validation.DbEntityValidationException)ex;
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.AppendLine("Validation failed for one or more entities:");
|
||||
foreach (var dbEntityError in dbException.EntityValidationErrors)
|
||||
{
|
||||
message.Append("'").Append(dbEntityError.Entry.Entity.GetType().Name).AppendLine("' Object");
|
||||
foreach (var dbValidationError in dbEntityError.ValidationErrors)
|
||||
{
|
||||
message.Append(" ").Append(dbValidationError.PropertyName).Append(": ").AppendLine(dbValidationError.ErrorMessage);
|
||||
}
|
||||
}
|
||||
Log(EventTypeIds.Exception, Component, ex.GetType().Name, message.ToString(), ex.StackTrace);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(EventTypeIds.Exception, Component, ex.GetType().Name, ex.Message, ex.StackTrace);
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
Log(EventTypeIds.ExceptionWithInner, Component, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(EventTypeIds.Exception, Component, ex.GetType().Name, ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyFileVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyVersion("1.2.0513.1327")]
|
||||
[assembly: AssemblyFileVersion("1.2.0513.1327")]
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyFileVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyVersion("1.2.0513.1327")]
|
||||
[assembly: AssemblyFileVersion("1.2.0513.1327")]
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyFileVersion("1.2.0509.1622")]
|
||||
[assembly: AssemblyVersion("1.2.0513.1327")]
|
||||
[assembly: AssemblyFileVersion("1.2.0513.1327")]
|
||||
Reference in New Issue
Block a user