- ABP Framework version: 4.0.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Seperated (Angular): no
- Exception message and stack trace:
API are not automatically generated
- Steps to reproduce the issue:
- Run abp add-module Acme.Software.SimpleTask --new --add-to-solution-file
- Create a ITaskAppService with a simple method GetAll as follows under the folder call Tasks in the Application.Contract Project in the modules folder
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace Acme.Software.SimpleTask.Tasks
{
public interface ITaskAppService : IApplicationService
{
Task<ListResultDto<TaskDto>> GetAllAsync(GetAllTasksInput input);
}
}
- Create the TaskAppService as follows under the folder called Tasks in the Application.Contract Project in the Modules Folder
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace Acme.Software.SimpleTask.Tasks
{
public class TaskAppService : SimpleTaskAppService, ITaskAppService
{
private readonly IRepository<Task, Guid> _taskRepository;
public TaskAppService(IRepository<Task, Guid> taskRepository)
{
_taskRepository = taskRepository;
}
public async Task<ListResultDto<TaskDto>> GetAllAsync(GetAllTasksInput input)
{
var tasks = await AsyncExecuter.ToListAsync(_taskRepository
.WhereIf(input.State.HasValue, t => t.State == input.State.Value)
.OrderByDescending(t => t.CreationTime)
);
return new ListResultDto<TaskDto>(ObjectMapper.Map<List<Task>, List<TaskDto>>(tasks));
}
}
}
- Run the project and navigate to Swager can't see the GetAll API
Solution Structure is as follws
8 Answer(s)
-
0
Hi,
You need create an
ApiController, just likeSampleControllerMarkdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Why, ABP create them automatically right?? if i follow the BookStore Tutorial then it is all automatic no need to create API Controller
If i have to create a APIController in what project ?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Why, ABP create them automatically right?? if i follow the BookStore Tutorial then it is all automatic no need to create API Controller
Because the module template is different from the app template. It is microservice compatible
If i have to create a APIController in what project ?
In
*.HttpApiproject.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
can you please explain this a little bit more, having explored the samples like the Blogging modules.
I can't see a reason why the API have to be implemented in
*.HTTPApias they are all being implemented, so wouldn't it be better to just automagiclly create them ?Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)


