Exemplo n.º 1
0
        public override void LogMessage(string subject, string message)
        {
            Error error = ErrorFactory.GetInformationalError(subject, message, LogLevel.Information.ToNameString());

            //Must use ServiceProvider as DBContext is Scope Specific and Thrown Errors dispose of this context
            UnitOfWork unitOfWork = _serviceProvider.GetService(typeof(UnitOfWork)) as UnitOfWork;

            if (unitOfWork == null)
            {
                return;
            }
            unitOfWork.Errors.Add(error);
            unitOfWork.SaveChanges();
        }