Search code examples
c#asp.netasp.net-web-apidependency-injectionasp.net-boilerplate

How to add new Dynamic Web API to ABP?


I want to add new API to ASP.NET Boilerplate's template for ASP.NET Core.

I've tried to make it, but I always get response code 500 on Swagger. How can I add new API?

Error 500 on Swagger

Update

Mvc.ExceptionHandling.AbpExceptionFilter - Can't create component 'CityInfo.Models.TempatManager' as it has dependencies to be satisfied.

'CityInfo.Models.TempatManager' is waiting for the following dependencies: - Service 'Abp.Domain.Repositories.IRepository`1[[CityInfo.Models.Tempat, CityInfo.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.


Solution

  • CityInfo.Models.TempatManager is waiting for CityInfo.Models.Tempat which was not registered.

    So what you have to do; Inherit Tempat from Entity or FullAuditedEntity

    public class Tempat  : FullAuditedEntity
    {
         //.....
    }
    

    and add this to your DbContext

    public virtual DbSet<Tempat> Tempats { get; set; }
    

    Further info, read: https://aspnetboilerplate.com/Pages/Documents/Entities