public static IMapper GetMapper()
        => new MapperConfiguration(cfg =>
        {
            cfg.CreateMap <ApplicationPool, ApplicationPoolGetDto>()
            .ForMember(dm => dm.Status, o => o.MapFrom(sm => sm.State))
            .ForMember(dm => dm.Identity, o => o.MapFrom(sm => sm.ProcessModel.IdentityType))
            .ForMember(dm => dm.Applications,
                       o => o.MapFrom(sm => ApplicationPoolUtils.GetNumberOfApplicationPoolApplications(sm.Name)));

            cfg.CreateMap <ApplicationPool, ApplicationPoolEditablePropertiesDto>()
            .ForMember(dm => dm.Identity, o => o.MapFrom(sm => sm.ProcessModel.IdentityType));

            cfg.CreateMap <App, ApplicationGetDto>()
            .ForMember(dm => dm.Name, o => o.MapFrom(sm => ApplicationUtils.ConvertPathToName(sm.Path)))
            .ForMember(dm => dm.PhysicalPath,
                       o => o.MapFrom(sm => sm.VirtualDirectories["/"].PhysicalPath))
            .ForMember(dm => dm.ApplicationPoolStatus,
                       o => o.MapFrom(sm =>
                                      ApplicationPoolUtils.GetApplicationPoolStatus(sm.ApplicationPoolName)));

            cfg.CreateMap <App, ApplicationEditablePropertiesDto>()
            .ForMember(dm => dm.Name, o => o.MapFrom(sm => ApplicationUtils.ConvertPathToName(sm.Path)))
            .ForMember(dm => dm.PhysicalPath,
                       o => o.MapFrom(sm => sm.VirtualDirectories["/"].PhysicalPath));

            cfg.CreateMap <Build, BuildGetDto>();
        })
        .CreateMapper();
示例#2
0
 private IEnumerable <BuildApplication> MapToBuildApplications(IEnumerable <App> applicationCollection)
 => applicationCollection.Where(x => PathIsDesired(x.Path))
 .Select(x => new BuildApplication(ApplicationUtils.ConvertPathToName(x.Path),
                                   GetApplicationPoolDto(x.ApplicationPoolName)));
示例#3
0
 public App GetApplication(string name, Site site)
 => GetSiteApplications(site)
 .SingleOrDefault(x =>
                  ApplicationUtils.ConvertPathToName(x.Path).Equals(name, StringComparison.OrdinalIgnoreCase));
示例#4
0
 public IEnumerable <App> GetSiteApplications(string subString, Site site)
 => site.Applications.Where(x =>
                            ApplicationUtils.ConvertPathToName(x.Path.ToLower()).Contains(subString.ToLower()));
示例#5
0
 public IEnumerable <App> GetApplications(string subString)
 => BrowseApplications()
 .Where(x => ApplicationUtils.ConvertPathToName(x.Path).ToLower().Contains(subString.ToLower()));