0
buaziz created
- ABP Framework version: v2.9
- UI type: Angular
- Identity Server Seperated (Angular)
- Steps to reproduce the issue:
- Create new AppService
- Add GetList Method
- Angular client : Generate proxy - abp generate-proxy
Issue: I have a simple app service with one method but the generated proxy for the output DTO is incorrect.
AppService Method
public virtual async Task<PagedResultDto<CampaignDto>> GetCampaignListAsync(GetCampaignsInput input)
{
var totalCount = await _campaignRepository.GetCountAsync(input.FilterText, input.Name);
var items = await _campaignRepository.GetListAsync(input.FilterText, input.Name, input.Sorting, input.MaxResultCount, input.SkipCount, false);
return new PagedResultDto<CampaignDto>
{
TotalCount = totalCount,
Items = ObjectMapper.Map<List<Campaign>, List<CampaignDto>>(items)
};
}
Here is the problem>> Generated Proxy (incorrect)
import { ListResultDto } from '@abp/ng.core';
export class CampaignDto extends ListResultDto<ACME.Campaigns.CampaignDto> {
totalCount: number;
items: any[];
constructor(initialValues: Partial<CampaignDto> = {}) {
super(initialValues);
}
}
Generated Service (correct)
import { RestService , PagedResultDto} from '@abp/ng.core';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import {GetCampaignsInput, CampaignDto} from '../models';
@Injectable({providedIn: 'root'})
export class CampaignService {
apiName = 'Default';
constructor(private restService: RestService) {}
getCampaignListByInput(params = {} as GetCampaignsInput): Observable<PagedResultDto<CampaignDto>> {
return this.restService.request({ url: '/api/app/campaign/campaignList', method: 'GET', params },{ apiName: this.apiName });
}
}
DTO Class
namespace ACME.Campaigns
{
public class CampaignDto : AuditedEntityDto<Guid>
{
public string Name { get; set; }
}
}
3 Answer(s)
-
0
repro on the BookStore sample app
book-dto.ts
import { ListResultDto } from '@abp/ng.core'; export class BookDto extends ListResultDto<Acme.BookStore.BookDto> { totalCount: number; items: any[]; constructor(initialValues: Partial<BookDto> = {}) { super(initialValues); } }
book-test.service.ts
import { RestService , PagedResultDto} from '@abp/ng.core'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import {BookDto} from '../models'; @Injectable({providedIn: 'root'}) export class BookTestService { apiName = 'Default'; constructor(private restService: RestService) {} getList(): Observable<PagedResultDto<BookDto>> { return this.restService.request({ url: '/api/app/bookTest', method: 'GET' },{ apiName: this.apiName }); } }
-
0
@buaziz sorry for my late response! did you manage to solve the issue?
-
0
solved with v3.0.5