Skip to content

Instantly share code, notes, and snippets.

@jonathascosta
Created November 1, 2012 18:56
Show Gist options
  • Select an option

  • Save jonathascosta/3995718 to your computer and use it in GitHub Desktop.

Select an option

Save jonathascosta/3995718 to your computer and use it in GitHub Desktop.
if (entity.GetType() != typeof(LogAuditoriaEntity) && (entity is AuditableEntity))
{
try
{
var logAuditoria = new LogAuditoriaEntity
{
NomeTabela = ObterNomeTabela(persister),
TipoOperacao = operacao,
TxtComando = ObterComandoSql(session),
ForeignId = id.ToString()
};
var newSession = session.GetSession(EntityMode.Poco);
newSession.Save(logAuditoria);
newSession.Flush();
}
catch (NotSupportedException ex)
{
var logger = LogManager.GetLogger("GeneralLog");
logger.Error(string.Format("Persister não suportado pela auditoria: '{0}'", ex.Message));
}
catch
{
var logger = LogManager.GetLogger("GeneralLog");
logger.Error(string.Format("Não foi possível gravar o log de auditoria do usuário '{0}'.", (entity as AuditableEntity).CodUsuarioAtu));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment