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); } } } }