private static string GetMessage(DataException ex) { // An exception occurred while initializing the database. See the InnerException for details. var errors = new StringBuilder(); errors.AppendLine(); #if DEBUG errors.AppendLine($"[{ex.GetType().Name}]"); #endif if (ex.Message.Contains("An exception occurred while initializing the database")) { errors.AppendLine("در زمان مقداردهی اولیه به پایگاه داده خطایی رخ داده است"); } else { errors.AppendLine($"{ex.GetType().Name}: {ex.Message}"); } errors.AppendLine(); return(errors.ToString()); }