0
xiexingen created
3 Answer(s)
-
0
Hi,
We will fix the problem and your ticket refunded.
-
0
You can try
CreateMap<DirectoryDescriptor, DirectoryContentDto>() .ForMember(dest => dest.IsDirectory, opt => opt.MapFrom(src => true)) .ForMember(dest => dest.Size, opt => opt.MapFrom(src => 0)) .ForMember(dest => dest.IconInfo, opt => opt.Ignore()) .MapExtraProperties(); CreateMap<FileDescriptor, DirectoryContentDto>() .ForMember(dest => dest.IsDirectory, opt => opt.MapFrom(src => false)) .ForMember(dest => dest.IconInfo, opt => opt.Ignore()) .MapExtraProperties(); [ExposeServices(typeof(IDirectoryDescriptorAppService))] public class MyDirectoryDescriptorAppService : DirectoryDescriptorAppService { public MyDirectoryDescriptorAppService(IDirectoryManager directoryManager, IFileManager fileManager, IDirectoryDescriptorRepository directoryDescriptorRepository, IFileDescriptorRepository fileDescriptorRepository, IOptions<FileIconOption> fileIconOption) : base(directoryManager, fileManager, directoryDescriptorRepository, fileDescriptorRepository, fileIconOption) { } public override async Task<PagedResultDto<DirectoryContentDto>> GetContentAsync(DirectoryContentRequestInput input) { var result = new List<DirectoryContentDto>(); var subDirectoryCount = await DirectoryDescriptorRepository.GetChildrenCountAsync(input.Id, input.Filter); var subFileCount = await FileDescriptorRepository.CountDirectoryFilesAsync(input.Id, input.Filter); // directory can be orderable for only its name var directorySorting = input.Sorting?.IndexOf("name asc", StringComparison.OrdinalIgnoreCase) >= 0 ? "name asc" : input.Sorting?.IndexOf("name desc", StringComparison.OrdinalIgnoreCase) >= 0 ? "name desc" : null; var subDirectories = await DirectoryDescriptorRepository.GetChildrenAsync(input.Id, input.Filter, directorySorting, input.MaxResultCount, input.SkipCount); result.AddRange(ObjectMapper.Map<List<DirectoryDescriptor>, List<DirectoryContentDto>>(subDirectories)); if (await AuthorizationService.IsGrantedAsync(FileManagementPermissions.FileDescriptor.Default)) { var fileSkipCount = input.SkipCount <= subDirectoryCount ? 0 : input.SkipCount - subDirectoryCount; var fileMaxResultCount = input.MaxResultCount - subDirectories.Count; var subFiles = await FileDescriptorRepository.GetListAsync(input.Id, input.Filter, input.Sorting, fileMaxResultCount, fileSkipCount); var subFilesDto = ObjectMapper.Map<List<FileDescriptor>, List<DirectoryContentDto>>(subFiles); foreach (var fileDto in subFilesDto) { fileDto.IconInfo = FileIconOption.GetFileIconInfo(fileDto.Name); result.Add(fileDto); } } return new PagedResultDto<DirectoryContentDto>(subDirectoryCount + subFileCount, result); } }
-
0
thanks