Пример #1
0
        public List <SqlServerDataViewModel> Read <SqlServerDataViewModel>(Expression <Func <SqlServerData, bool> > predicate)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMissingTypeMaps = true;
            });

            var query = _sqlServerDataRep.GetQueryable().Where(predicate);

            return(query.ProjectTo <SqlServerDataViewModel>(config).ToList());
        }
Пример #2
0
        public List <SqlJobsViewModel> Get(int sqlServerDataId, string currentUserId, string jtSorting)
        {
            var _config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMissingTypeMaps = true;
            });

            var mapper = new Mapper(_config);

            var sqlServer = _sqlServerDataRepository.GetQueryable().Where
                                (x => x.ApplicationUserId == currentUserId && x.SqlServerDataId == sqlServerDataId).SingleOrDefault();
            IJobsDataSource source = new JobsDataSource(sqlServer.ConnectionString);

            return(mapper.DefaultContext.Mapper.Map <List <SqlJobsViewModel> >(source.Get(jtSorting)));
        }
Пример #3
0
        public List <CpuLoadViewModel> Get(int sqlServerDataId, string currentUserId, int numberOfRecords)
        {
            var _config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMissingTypeMaps = true;
                cfg.AddGlobalIgnore("EventTimeText");
            });

            var mapper = new Mapper(_config);

            var sqlServer = _sqlServerDataRepository.GetQueryable().Where
                                (x => x.ApplicationUserId == currentUserId && x.SqlServerDataId == sqlServerDataId).SingleOrDefault();
            ICpuDataSource source = new CpuDataSource(sqlServer.ConnectionString);

            return(mapper.DefaultContext.Mapper.Map <List <CpuLoadViewModel> >(source.Get(numberOfRecords)));
        }
        public List <SqlDatabasesSizeViewModel> Get(int sqlServerDataId, string currentUserId, List <int> databaseIds, string jtSorting)
        {
            var _config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMissingTypeMaps = true;
                //exist just in ViewModel
                cfg.AddGlobalIgnore("SizeMB");
            });

            var mapper = new Mapper(_config);

            var sqlServer = _sqlServerDataRepository.GetQueryable().Where
                                (x => x.ApplicationUserId == currentUserId && x.SqlServerDataId == sqlServerDataId).SingleOrDefault();
            IDatabaseSizeDataSource source = new DatabaseSizeDataSource(sqlServer.ConnectionString);

            return(mapper.DefaultContext.Mapper.Map <List <SqlDatabasesSizeViewModel> >(source.Get(databaseIds, jtSorting)));
        }