ثبت استثناهای مدیریت شده توسط ELMAH
نویسنده: وحید نصیری
تاریخ: ۱۳۸۹/۱۱/۰۹ ۱۳:۰۷:۰۰
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
...
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
... Elmah.ErrorLog.GetDefault(null).Log(new Error(ex))
using System;
using System.Text;
using Elmah;
namespace Common.WebToolkit
{
public static class ElmahLogEx
{
public static void LogException(this string ex)
{
if (string.IsNullOrWhiteSpace(ex))
return;
LogException(new Exception(ex));
}
public static void LogException(this Exception ex)
{
if (ex == null) return;
try
{
ErrorSignal.FromCurrentContext().Raise(ex);
}
catch
{
ErrorLog.GetDefault(null).Log(new Error(ex));
}
}
}
} public async Task<string> SaveAllChangesAsync(bool invalidateCacheDependencies = true, Guid? auditUserId = null)
{
try
{
if (auditUserId.HasValue)
AuditFields(auditUserId.Value);
await SaveChangesAsync();
if (!invalidateCacheDependencies) return string.Empty;
var changedEntityNames = GetChangedEntityNames();
new EFCacheServiceProvider().InvalidateCacheDependencies(changedEntityNames);
}
catch (DbUpdateConcurrencyException ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
return ConcurrencyMessage;
}
return string.Empty;
}