Base solution for your next web application
Open Closed

PhoneBook Tutorial AspNet Core fails #7339


User avatar
0
cashonledger created

Hi,

I'm trying to implement the tutorial for the PhoneBook for AspNet Core & Angular (here) and am failing in the last step when trying to run the application.

I added the documented source code to both projects, Core & Angular. Core is building & executing fine. I also executed nswag. But somehow the both components AddPhoneInputType and PhoneInPersonListDtoType that are required by Angular's phonebook.component.ts file are missing in the service-proxies.ts. I noticed that they are also missing in the Swagger UI. So somehow they are not part of the API interface.

What am I missing?

Thanks, Tuna


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @amplicade

    Could you share your AddPhoneInput.cs class ?

  • User Avatar
    0
    cashonledger created

    This is my AddPhoneInput.cs

    usingSystem.ComponentModel.DataAnnotations;
    
    namespace rytlex.Persons.Dto
    {
        public class AddPhoneInput
        {
            [Range(1, int.MaxValue)]
            public int PersonId { get; set; }
    
            [Required]
            public PhoneType Type { get; set; }
    
            [Required]
            [MaxLength(PhoneConsts.MaxNumberLength)]
            public string Number { get; set; }
        }
    }
    
  • User Avatar
    1
    ryancyq created
    Support Team

    Hi @amplicade, can you also share the code for PersonAppService that you have created as per the tutorial intructions?

    if the API does not appear in swagger, it means the app service was not recognized by swagger as an endpoint, therefore when you refresh via nswag, the classes used in the app service will not be included in the service proxies.

  • User Avatar
    0
    cashonledger created

    Thank you @ryancyq and @ismcagdas for you support so far. We have decided to not follow up on the PhoneBook examle and are using the ApsNetZero Extension instead which is working fine. Thus we can close this issue.