public void MxecutonFunction() { DbErrorLog errorlog = new DbErrorLog(); errorlog.FunctionArgument = "2"; errorlog.Error = "Entered"; errorlog.ModuleFunction = "Check"; DataContext dataContext = new DataContext(); dataContext.DbErrorLogs.Add(errorlog); dataContext.SaveChanges(); }
public static void LogError(string module, string function, string argument, string error) { using (DataContext context = new DataContext()) { DbErrorLog dbErrorLog = new DbErrorLog(); dbErrorLog.ModuleName = module; dbErrorLog.ModuleFunction = function; dbErrorLog.FunctionArgument = argument; dbErrorLog.Error = error; dbErrorLog.IsActive = true; dbErrorLog.CreatedDate = DateTime.Now; context.DbErrorLogs.Add(dbErrorLog); context.SaveChanges(); } }