Multiple projects for Application Services in ASP.

2019-07-14 05:23发布

问题:

I have an application with two projects that contain IApplicationService classes, but the framework only resolves client proxies (in JavaScript: abp.services.app.xxxx) by default for Application project that comes with base template.

myProject.Application => default ASP.NET Boilerplate
myProject.ExtraServices => my own (not generating client proxies)

Thanks.

回答1:

ASP.NET Core

Create controllers for your ExtraServices project in MyProjectWebCoreModule:

Configuration.Modules.AbpAspNetCore()
    .CreateControllersForAppServices(
        typeof(ExtraServicesModule).GetAssembly()
    );

ASP.NET MVC 5

Create controllers for your ExtraServices project in MyProjectWebApiModule:

Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder
    .ForAll<IApplicationService>(typeof(ExtraServicesModule).Assembly, "app")
    .Build();