Update: DbEntityValidationException Detailed Logs

This commit is contained in:
Gary Sharp
2013-05-13 13:28:25 +10:00
parent 4481909866
commit 05a4907b2c
7 changed files with 35 additions and 15 deletions
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0509.1618")] [assembly: AssemblyVersion("1.2.0513.1327")]
[assembly: AssemblyFileVersion("1.2.0509.1618")] [assembly: AssemblyFileVersion("1.2.0513.1327")]
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0509.1622")] [assembly: AssemblyVersion("1.2.0513.1327")]
[assembly: AssemblyFileVersion("1.2.0509.1622")] [assembly: AssemblyFileVersion("1.2.0513.1327")]
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0509.1622")] [assembly: AssemblyVersion("1.2.0513.1327")]
[assembly: AssemblyFileVersion("1.2.0509.1622")] [assembly: AssemblyFileVersion("1.2.0513.1327")]
+20
View File
@@ -43,6 +43,25 @@ namespace Disco.Services.Logging
Log(EventTypeIds.Error, Messages); Log(EventTypeIds.Error, Messages);
} }
public static void LogException(string Component, Exception ex) public static void LogException(string Component, Exception ex)
{
// Handle Special-Case Errors
if (ex is System.Data.Entity.Validation.DbEntityValidationException)
{
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
{ {
if (ex.InnerException != null) if (ex.InnerException != null)
{ {
@@ -53,6 +72,7 @@ namespace Disco.Services.Logging
Log(EventTypeIds.Exception, Component, ex.GetType().Name, ex.Message, ex.StackTrace); Log(EventTypeIds.Exception, Component, ex.GetType().Name, ex.Message, ex.StackTrace);
} }
} }
}
public static void LogLogInitialized(string PersistantStorePath) public static void LogLogInitialized(string PersistantStorePath)
{ {
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0509.1622")] [assembly: AssemblyVersion("1.2.0513.1327")]
[assembly: AssemblyFileVersion("1.2.0509.1622")] [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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0509.1622")] [assembly: AssemblyVersion("1.2.0513.1327")]
[assembly: AssemblyFileVersion("1.2.0509.1622")] [assembly: AssemblyFileVersion("1.2.0513.1327")]
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0509.1622")] [assembly: AssemblyVersion("1.2.0513.1327")]
[assembly: AssemblyFileVersion("1.2.0509.1622")] [assembly: AssemblyFileVersion("1.2.0513.1327")]