You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
889 B

using System;
using System.Collections.Generic;
using System.Data.Entity.Validation;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CK.SCP.Utils;
namespace CK.SCP.Controller
{
public class SCP_EXCEPTION_CONTROLLER
{
public static void GetEntityFrameWorkMessage(Exception p_ex,Type p_type,string p_medth)
{
if (p_ex is DbEntityValidationException)
{
var ex = p_ex as DbEntityValidationException;
var errorMessages = ex.EntityValidationErrors
.SelectMany(validationResult => validationResult.ValidationErrors)
.Select(m => m.ErrorMessage);
var fullErrorMessage = string.Join(", ", errorMessages);
LogHelper.Writlog(LogHelper.LogType.Error, p_type, p_medth, fullErrorMessage);
}
}
}
}