Work on Aspnet core boilerplate framework stuck on one issue, form my controller failed to call services.
Application class library contains IEmployeeService and EmployeeService, how to call them from my EmployeeController.
Service
public interface IEmployeeService
{
int CreateEmployee(CreateEmployeeDto data);
IEnumerable<EmployeeListDto> GetEmployeeList();
}
public class EmployeeService : IEmployeeService
{
}
Controller
[AbpMvcAuthorize]
public class EmployeeController : HRISControllerBase
{
private readonly IEmployeeService _employeeService;
public EmployeeController(
IEmployeeService employeeService
)
{
_employeeService = employeeService;
}
public ActionResult Index()
{
return View();
}
}
Note: Do project need to configure something in ConfigureServices on the Startup.cs file.
According to the docs
"ASP.NET Boilerplate automatically registers all Repositories, Domain Services, Application Services"
As such all you should need to do is change your IEmployeeService to inherit from IApplicationService:
public interface IEmployeeService : IApplicationService
{
int CreateEmployee(CreateEmployeeDto data);
IEnumerable<EmployeeListDto> GetEmployeeList();
}