public static async Task <ServiceEnvironmentStatus> GetServiceEnvironmentStatusAsync(this ServiceMonitorDbContext dbContext, ServiceEnvironmentStatus entity)
 => await dbContext.ServiceEnvironmentStatus.FirstOrDefaultAsync(item => item.ServiceEnvironmentStatusID == entity.ServiceEnvironmentStatusID);
 public static async Task <User> GetUserAsync(this ServiceMonitorDbContext dbContext, string userName)
 => await dbContext.User.FirstOrDefaultAsync(item => item.UserName == userName);
 public static IQueryable <ServiceUser> GetServiceUserByUserID(this ServiceMonitorDbContext dbContext, int?userID)
 => dbContext.ServiceUser.Where(item => item.UserID == userID);
 public static IQueryable <ServiceWatcherItemDto> GetActiveServiceWatcherItems(this ServiceMonitorDbContext dbContext)
 {
     return(from serviceEnvironment in dbContext.ServiceEnvironment
            join service in dbContext.Service on serviceEnvironment.ServiceID equals service.ServiceID
            join serviceWatcher in dbContext.ServiceWatcher on serviceEnvironment.ServiceID equals serviceWatcher.ServiceID
            join environmentCategory in dbContext.EnvironmentCategory on serviceEnvironment.EnvironmentCategoryID equals environmentCategory.EnvironmentCategoryID
            select new ServiceWatcherItemDto
     {
         ServiceEnvironmentID = serviceEnvironment.ServiceEnvironmentID,
         ServiceID = service.ServiceID,
         Environment = environmentCategory.EnvironmentCategoryName,
         ServiceName = service.Name,
         Interval = serviceEnvironment.Interval,
         Url = serviceEnvironment.Url,
         Address = serviceEnvironment.Address,
         ConnectionString = serviceEnvironment.ConnectionString,
         TypeName = serviceWatcher.TypeName
     });
 }