public void LogExceptionNo(Exception exception, string no, string username) { // try-catch because database itself could be down or Request context is unknown. try { // ** Prototype pattern. the Error object has it default values initialized var error = new Error() { UserName = username, ErrorID = no, Exception = exception.GetType().FullName, Message = exception.Message, Everything = exception.ToString(), IpAddress = HttpContext.Current.Request.UserHostAddress, UserAgent = HttpContext.Current.Request.UserAgent, PathAndQuery = HttpContext.Current.Request.Url == null ? "" : HttpContext.Current.Request.Url.PathAndQuery, HttpReferer = HttpContext.Current.Request.UrlReferrer == null ? "" : HttpContext.Current.Request.UrlReferrer.PathAndQuery, CreatedOn = DateTime.Now, ChangedOn = DateTime.Now }; using (MyRealtyWebDBEntities context = new MyRealtyWebDBEntities()) { context.Errors.Add(error); context.SaveChanges(); } //DealSiteContext.Errors.Insert(error); } catch { /* do nothing, or send email to webmaster*/} }
public AuthorizeService() { dbContext = new MyRealtyWebDBEntities(); }
public BaseActivity() { dbContext = new MyRealtyWebDBEntities(); context = new DataFunctions(); }
public FreeTrailService() { dbContext = new MyRealtyWebDBEntities(); }
public UserService() { dbContext = new MyRealtyWebDBEntities(); }