abp proxy-generator -t ng doesn't work with inheritance

Discussão em 'Angular' iniciado por Tito, Março 16, 2025.

  1. Tito

    Tito Guest

    I downloaded the github example from the ABP bookstore described in here: https://abp.io/docs/latest/tutorials/book-store/part-09?UI=NG&DB=Mongo

    I modified it to add new services for exams, each exam has different types of questions Dtos that inherits from the base class QuestionDto as bellow:

    public class QuestionDto : AuditedEntityDto<Guid>
    {
    public string Name { get; set; }
    public QuestionType Type { get; set; }
    public string Title { get; set; }
    public string MarksText { get; set; }
    public int MarkValue { get; set; }
    }

    public class MultipleChoiceQuestionDto : QuestionDto
    {
    public string Subtitle { get; set; }

    [JsonConverter(typeof(ChoicesDtoConverter))]
    public List<(char Option, string Text)> Choices { get; set; }

    public char CorrectChoice { get; set; }
    public bool IsAnExampleQuestion { get; set; }
    }


    There is the service method GetListAsync that I am executing as bellow:

    [Authorize(BookStorePermissions.Books.Default)]
    public class ExamAppService : CrudAppService<
    Exam, // The Exam entity
    ExamDto, // Used to show exams
    Guid, // Primary key of the exam entity
    PagedAndSortedResultRequestDto, // Used for paging/sorting
    CreateExamDto, // Used to create an exam
    UpdateExamDto>, // Used to update an exam
    IExamAppService // Implement the IExamAppService
    {
    private readonly IRepository<Exam, Guid> _examRepository;

    public ExamAppService(IRepository<Exam, Guid> repository)
    : base(repository)
    {
    }

    public async override Task<PagedResultDto<ExamDto>> GetListAsync(PagedAndSortedResultRequestDto input)
    {...


    The problem is that even it returns the right value in swagger when executing this method, the models generated by the command abp proxy-generator -t ng in angular is missing the subtypes of QuestionDto. Do you know how can I explicitly say that those subtype of classes exist so it will take it into consideration?

    Continue reading...

Compartilhe esta Página