Introduce IRemoteService interface.

pull/112/head
Halil İbrahim Kalkan 7 years ago
parent d9cf5c7d22
commit b6820e527b

@ -1,17 +1,12 @@
using System;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.Application.Services;
using Volo.Abp.Http;
using Volo.Abp.Reflection;
namespace Volo.Abp.AspNetCore.Mvc
{
/// <summary>
/// Used to add application services as controller.
/// </summary>
public class AbpAppServiceControllerFeatureProvider : ControllerFeatureProvider
{
private readonly IAbpApplication _application;
@ -25,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{
var type = typeInfo.AsType();
if (!typeof(IApplicationService).IsAssignableFrom(type) ||
if (!typeof(IRemoteService).IsAssignableFrom(type) ||
!typeInfo.IsPublic || typeInfo.IsAbstract || typeInfo.IsGenericType)
{
return false;

@ -37,7 +37,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var controllerType = controller.ControllerType.AsType();
var configuration = GetControllerSettingOrNull(controllerType);
if (IsApplicationService(controllerType))
if (IsRemoteService(controllerType))
{
controller.ControllerName = controller.ControllerName.RemovePostFix(ApplicationService.CommonPostfixes);
configuration?.ControllerModelConfigurer(controller);
@ -314,9 +314,9 @@ namespace Volo.Abp.AspNetCore.Mvc
return selector.AttributeRouteModel == null && selector.ActionConstraints.IsNullOrEmpty();
}
protected virtual bool IsApplicationService(Type controllerType)
protected virtual bool IsRemoteService(Type controllerType)
{
return typeof(IApplicationService).GetTypeInfo().IsAssignableFrom(controllerType);
return typeof(IRemoteService).GetTypeInfo().IsAssignableFrom(controllerType);
}
}
}

@ -23,7 +23,7 @@ namespace Microsoft.Extensions.DependencyInjection
//TODO: Add option to change type filter
var serviceTypes = assembly.GetTypes().Where(t =>
t.IsInterface && t.IsPublic && typeof(IApplicationService).IsAssignableFrom(t)
t.IsInterface && t.IsPublic && typeof(IRemoteService).IsAssignableFrom(t)
);
foreach (var serviceType in serviceTypes)

@ -27,8 +27,4 @@
<PackageReference Include="Nito.AsyncEx.Context" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Volo\Abp\Http\" />
</ItemGroup>
</Project>

@ -5,7 +5,7 @@ namespace Volo.Abp.Application.Services
/// <summary>
/// This interface must be implemented by all application services to register and identify them by convention.
/// </summary>
public interface IApplicationService : ITransientDependency
public interface IApplicationService : ITransientDependency, IRemoteService
{
}

@ -0,0 +1,6 @@
namespace Volo.Abp.Application.Services
{
public interface IRemoteService
{
}
}

@ -1,11 +1,11 @@
using System;
using System.Reflection;
namespace Volo.Abp.Http
namespace Volo.Abp.Application.Services
{
[Serializable]
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Method)]
public class RemoteServiceAttribute : Attribute
public class RemoteServiceAttribute : Attribute //TODO: Consider to move to another namespace (with IRemoteService)?
{
/// <summary>
/// Default: true.

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;
using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.Http.DynamicProxying

Loading…
Cancel
Save