Get root path from areanem for remote services.

pull/216/head
Halil İbrahim Kalkan 8 years ago
parent e7c40358f3
commit 199b24f6f7

3
.gitignore vendored

@ -255,4 +255,5 @@ paket-files/
build/outputs
src/AbpDesk/AbpDesk.Web.Mvc/Logs
/src/Volo.Abp.Identity.HttpApi.Host/Logs
samples/MicroserviceDemo/MicroserviceDemo.Web/Logs/*.txt
src/MicroserviceDemo/MicroserviceDemo.Web/Logs/*.txt
src/MicroserviceDemo/MicroserviceDemo.TenantService/Logs/*.txt

@ -230,8 +230,19 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
protected virtual string GetRootPathOrDefault(Type controllerType)
{
return GetControllerSettingOrNull(controllerType)?.RootPath ??
ModuleApiDescriptionModel.DefaultRootPath;
var controllerSetting = GetControllerSettingOrNull(controllerType);
if (controllerSetting?.RootPath != null)
{
return GetControllerSettingOrNull(controllerType)?.RootPath;
}
var areaAttribute = controllerType.GetCustomAttributes().OfType<AreaAttribute>().FirstOrDefault();
if (areaAttribute.RouteValue != null)
{
return areaAttribute.RouteValue;
}
return ModuleApiDescriptionModel.DefaultRootPath;
}
[CanBeNull]

@ -73,19 +73,23 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
private static bool IsRemoteService(Type type)
{
if (!typeof(IRemoteService).IsAssignableFrom(type) || !type.IsPublic || type.IsAbstract || type.IsGenericType)
if (!type.IsPublic || type.IsAbstract || type.IsGenericType)
{
return false;
}
var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(type);
if (remoteServiceAttr != null && !remoteServiceAttr.IsEnabledFor(type))
{
return false;
}
return true;
if (typeof(IRemoteService).IsAssignableFrom(type))
{
return true;
}
return false;
}
}
}

@ -2,10 +2,13 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace Volo.Abp.MultiTenancy
{
[Controller]
[RemoteService]
[Area("multi-tenancy")]
public class TenantController : ITenantAppService //TODO: Throws exception on validation if we inherit from Controller
{
private readonly ITenantAppService _service;

Loading…
Cancel
Save