I am getting the following error when query a recursive entity lookup.
Error:
{"message":"An error has occurred.","exceptionMessage":"There is an action GetCategories defined for api controller app/category but with a different HTTP Verb. Request verb is GET. It should be Post","exceptionType":"System.Web.HttpException","stackTrace":" at Abp.WebApi.Controllers.Dynamic.Selectors.AbpApiControllerActionSelector.GetActionDescriptorByActionName(HttpControllerContext controllerContext, DynamicApiControllerInfo controllerInfo, String actionName)\r\n at Abp.WebApi.Controllers.Dynamic.Selectors.AbpApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)\r\n at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at Castle.Proxies.DynamicApiController
1Proxy_5.ExecuteAsync_callback(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at Castle.Proxies.Invocations.ApiController_ExecuteAsync_5.InvokeMethodOnTarget()\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Abp.WebApi.Controllers.Dynamic.Interceptors.AbpDynamicApiControllerInterceptor
1.Intercept(IInvocation invocation)\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Castle.Proxies.DynamicApiController`1Proxy_5.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}
The error only occurs after I added the first entry that has a ParentId
Model
[Table("Categories")]
public class Category : FullAuditedEntity
{
[Required]
public string Name { get; set; }
[Required]
public string SharepointMapping { get; set; }
public int? ParentId { get; set; }
public Category Parent { get; set; }
public List<Category> Children { get; set; }
}
CategoryAppService
public ListResultDto<CategoryListDto> GetCategories(GetCategoriesInput input)
{
var categories = _categoryRepository
.GetAll()
.WhereIf(
!input.Filter.IsNullOrEmpty(),
p => p.Name.Contains(input.Filter)
)
.OrderBy(p => p.Name)
.ToList();
return new ListResultDto<CategoryListDto>(categories.MapTo<List<CategoryListDto>>());
}
CategoryListDto
[AutoMapFrom(typeof(Category))]
public class CategoryListDto : FullAuditedEntityDto
{
public string Name { get; set; }
public string SharepointMapping { get; set; }
public int? ParentId { get; set; }
public virtual Category Parent { get; set; }
}