Browse Source

Refactored.

pull/122/head
Halil İbrahim Kalkan 9 years ago
parent
commit
29a7cfe9b2
  1. 2
      src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs
  2. 5
      src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpApiVersioningOptionsExtensions.cs
  3. 9
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  4. 9
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
  5. 3
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs
  6. 35
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AppServiceControllerOptions.cs
  7. 9
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  8. 10
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerFeatureProvider.cs
  9. 35
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
  10. 10
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConventionWrapper.cs
  11. 35
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerOptions.cs
  12. 6
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSetting.cs
  13. 6
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSettingList.cs
  14. 8
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/IAbpServiceConvention.cs
  15. 2
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/UrlActionNameNormalizerContext.cs
  16. 2
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/UrlControllerNameNormalizerContext.cs
  17. 8
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/IAbpAppServiceConvention.cs
  18. 5
      src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs
  19. 10
      src/Volo.Abp.Identity.HttpApi.Host/SwaggerDefaultValues.cs
  20. 4
      src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/AbpIdentityHttpApiModule.cs
  21. 2
      test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  22. 4
      test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs

2
src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs

@ -65,7 +65,7 @@ namespace AbpDesk.Web.Mvc
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.AppServiceControllers.Create(typeof(AbpDeskApplicationModule).Assembly);
options.ConventionalControllers.Create(typeof(AbpDeskApplicationModule).Assembly);
});
}

5
src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpApiVersioningOptionsExtensions.cs

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.AspNetCore.Mvc.Versioning.Conventions;
using Volo.Abp.ApiVersioning;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.Versioning;
namespace Microsoft.Extensions.DependencyInjection
@ -22,7 +23,7 @@ namespace Microsoft.Extensions.DependencyInjection
//TODO: Configuring api version should be done directly inside ConfigureAbp,
//TODO: not in a callback that will be called by MVC later! For that, we immediately need to controllerAssemblySettings
foreach (var setting in op.AppServiceControllers.ControllerAssemblySettings)
foreach (var setting in op.ConventionalControllers.ConventionalControllerSettings)
{
if (setting.ApiVersionConfigurer == null)
{
@ -36,7 +37,7 @@ namespace Microsoft.Extensions.DependencyInjection
});
}
private static void ConfigureApiVersionsByConvention(ApiVersioningOptions options, AbpControllerAssemblySetting setting)
private static void ConfigureApiVersionsByConvention(ApiVersioningOptions options, ConventionalControllerSetting setting)
{
foreach (var controllerType in setting.ControllerTypes)
{

9
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.Http;
using Volo.Abp.Http.Modeling;
@ -53,7 +54,7 @@ namespace Volo.Abp.AspNetCore.Mvc
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.AppServiceControllers.Create(typeof(AbpAspNetCoreMvcModule).Assembly, o =>
options.ConventionalControllers.Create(typeof(AbpAspNetCoreMvcModule).Assembly, o =>
{
o.RootPath = "abp";
});
@ -77,7 +78,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var partManager = services.GetSingletonInstance<ApplicationPartManager>();
var application = services.GetSingletonInstance<IAbpApplication>();
partManager.FeatureProviders.Add(new AbpAppServiceControllerFeatureProvider(application));
partManager.FeatureProviders.Add(new AbpConventionalControllerFeatureProvider(application));
services.Configure<MvcOptions>(mvcOptions =>
{
@ -114,8 +115,8 @@ namespace Volo.Abp.AspNetCore.Mvc
.ServiceProvider
.GetRequiredService<IOptions<AbpAspNetCoreMvcOptions>>()
.Value
.AppServiceControllers
.ControllerAssemblySettings
.ConventionalControllers
.ConventionalControllerSettings
.Select(s => s.Assembly)
.Distinct();

9
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs

@ -1,13 +1,14 @@
namespace Volo.Abp.AspNetCore.Mvc
using Volo.Abp.AspNetCore.Mvc.Conventions;
namespace Volo.Abp.AspNetCore.Mvc
{
public class AbpAspNetCoreMvcOptions
{
//TODO: Rename to ConventionalControllers
public AppServiceControllerOptions AppServiceControllers { get; }
public ConventionalControllerOptions ConventionalControllers { get; }
public AbpAspNetCoreMvcOptions()
{
AppServiceControllers = new AppServiceControllerOptions();
ConventionalControllers = new ConventionalControllerOptions();
}
}
}

3
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.ExceptionHandling;
using Volo.Abp.AspNetCore.Mvc.Uow;
using Volo.Abp.AspNetCore.Mvc.Validation;
@ -17,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc
private static void AddConventions(MvcOptions options, IServiceCollection services)
{
options.Conventions.Add(new AbpAppServiceConventionWrapper(services));
options.Conventions.Add(new AbpServiceConventionWrapper(services));
}
private static void AddFilters(MvcOptions options)

35
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AppServiceControllerOptions.cs

@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
using Volo.Abp.Http.Modeling;
namespace Volo.Abp.AspNetCore.Mvc
{
public class AppServiceControllerOptions
{
public ControllerAssemblySettingList ControllerAssemblySettings { get; }
public List<Type> FormBodyBindingIgnoredTypes { get; }
public AppServiceControllerOptions()
{
ControllerAssemblySettings = new ControllerAssemblySettingList();
FormBodyBindingIgnoredTypes = new List<Type>
{
typeof(IFormFile)
};
}
public AppServiceControllerOptions Create(Assembly assembly, [CanBeNull] Action<AbpControllerAssemblySetting> optionsAction = null)
{
var setting = new AbpControllerAssemblySetting(assembly, ModuleApiDescriptionModel.DefaultRootPath);
optionsAction?.Invoke(setting);
setting.Initialize();
ControllerAssemblySettings.Add(setting);
return this;
}
}
}

9
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs

@ -12,6 +12,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Volo.Abp.Application.Services;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.Utils;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Modeling;
@ -88,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc
AddParameterDescriptionsToModel(actionModel, method, apiDescription);
}
private static string CalculateControllerName(Type controllerType, AbpControllerAssemblySetting setting)
private static string CalculateControllerName(Type controllerType, ConventionalControllerSetting setting)
{
var controllerName = controllerType.Name.RemovePostFix("Controller").RemovePostFix(ApplicationService.CommonPostfixes);
@ -169,7 +170,7 @@ namespace Volo.Abp.AspNetCore.Mvc
return modelNameProvider.Name;
}
private static string GetRootPath([NotNull] Type controllerType, [CanBeNull] AbpControllerAssemblySetting setting)
private static string GetRootPath([NotNull] Type controllerType, [CanBeNull] ConventionalControllerSetting setting)
{
if (setting != null)
{
@ -186,9 +187,9 @@ namespace Volo.Abp.AspNetCore.Mvc
}
[CanBeNull]
private AbpControllerAssemblySetting FindSetting(Type controllerType)
private ConventionalControllerSetting FindSetting(Type controllerType)
{
foreach (var controllerSetting in _options.AppServiceControllers.ControllerAssemblySettings)
foreach (var controllerSetting in _options.ConventionalControllers.ConventionalControllerSettings)
{
if (controllerSetting.ControllerTypes.Contains(controllerType))
{

10
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceControllerFeatureProvider.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerFeatureProvider.cs

@ -3,13 +3,13 @@ using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class AbpAppServiceControllerFeatureProvider : ControllerFeatureProvider
public class AbpConventionalControllerFeatureProvider : ControllerFeatureProvider
{
private readonly IAbpApplication _application;
public AbpAppServiceControllerFeatureProvider(IAbpApplication application)
public AbpConventionalControllerFeatureProvider(IAbpApplication application)
{
_application = application;
}
@ -19,8 +19,8 @@ namespace Volo.Abp.AspNetCore.Mvc
//TODO: Move this to a lazy loaded field for efficiency.
var configuration = _application.ServiceProvider
.GetRequiredService<IOptions<AbpAspNetCoreMvcOptions>>().Value
.AppServiceControllers
.ControllerAssemblySettings
.ConventionalControllers
.ConventionalControllerSettings
.GetSettingOrNull(typeInfo.AsType());
return configuration != null;

35
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs

@ -14,13 +14,13 @@ using Volo.Abp.Http;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Reflection;
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class AbpAppServiceConvention : IAbpAppServiceConvention, ITransientDependency
public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
{
private readonly AbpAspNetCoreMvcOptions _options;
public AbpAppServiceConvention(IOptions<AbpAspNetCoreMvcOptions> options)
public AbpServiceConvention(IOptions<AbpAspNetCoreMvcOptions> options)
{
_options = options.Value;
}
@ -38,8 +38,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var configuration = GetControllerSettingOrNull(controllerType);
//TODO: We can remove different behaviour for ImplementsRemoteServiceInterface. If there is a configuration, then it should be applied!
//TODO: If so, we can rename AppServiceControllers to ConventionalControllers!
//TODO: But also consider AbpControllerAssemblySetting.IsRemoteService method too..!
//TODO: But also consider ConventionalControllerSetting.IsRemoteService method too..!
if (ImplementsRemoteServiceInterface(controllerType))
{
@ -58,7 +57,7 @@ namespace Volo.Abp.AspNetCore.Mvc
}
}
protected virtual void ConfigureRemoteService(ControllerModel controller, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual void ConfigureRemoteService(ControllerModel controller, [CanBeNull] ConventionalControllerSetting configuration)
{
ConfigureApiExplorer(controller);
ConfigureSelector(controller, configuration);
@ -95,7 +94,7 @@ namespace Volo.Abp.AspNetCore.Mvc
protected virtual bool CanUseFormBodyBinding(ActionModel action, ParameterModel parameter)
{
if (_options.AppServiceControllers.FormBodyBindingIgnoredTypes.Any(t => t.IsAssignableFrom(parameter.ParameterInfo.ParameterType)))
if (_options.ConventionalControllers.FormBodyBindingIgnoredTypes.Any(t => t.IsAssignableFrom(parameter.ParameterInfo.ParameterType)))
{
return false;
}
@ -168,7 +167,7 @@ namespace Volo.Abp.AspNetCore.Mvc
}
}
protected virtual void ConfigureSelector(ControllerModel controller, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual void ConfigureSelector(ControllerModel controller, [CanBeNull] ConventionalControllerSetting configuration)
{
RemoveEmptySelectors(controller.Selectors);
@ -185,7 +184,7 @@ namespace Volo.Abp.AspNetCore.Mvc
}
}
protected virtual void ConfigureSelector(string rootPath, string controllerName, ActionModel action, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual void ConfigureSelector(string rootPath, string controllerName, ActionModel action, [CanBeNull] ConventionalControllerSetting configuration)
{
RemoveEmptySelectors(action.Selectors);
@ -199,7 +198,7 @@ namespace Volo.Abp.AspNetCore.Mvc
}
}
protected virtual void AddAbpServiceSelector(string rootPath, string controllerName, ActionModel action, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual void AddAbpServiceSelector(string rootPath, string controllerName, ActionModel action, [CanBeNull] ConventionalControllerSetting configuration)
{
var httpMethod = SelectHttpMethod(action, configuration);
@ -212,12 +211,12 @@ namespace Volo.Abp.AspNetCore.Mvc
action.Selectors.Add(abpServiceSelectorModel);
}
protected virtual string SelectHttpMethod(ActionModel action, AbpControllerAssemblySetting configuration)
protected virtual string SelectHttpMethod(ActionModel action, ConventionalControllerSetting configuration)
{
return HttpMethodHelper.GetConventionalVerbForMethodName(action.ActionName);
}
protected virtual void NormalizeSelectorRoutes(string rootPath, string controllerName, ActionModel action, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual void NormalizeSelectorRoutes(string rootPath, string controllerName, ActionModel action, [CanBeNull] ConventionalControllerSetting configuration)
{
foreach (var selector in action.Selectors)
{
@ -236,12 +235,12 @@ namespace Volo.Abp.AspNetCore.Mvc
}
[CanBeNull]
protected virtual AbpControllerAssemblySetting GetControllerSettingOrNull(Type controllerType)
protected virtual ConventionalControllerSetting GetControllerSettingOrNull(Type controllerType)
{
return _options.AppServiceControllers.ControllerAssemblySettings.GetSettingOrNull(controllerType);
return _options.ConventionalControllers.ConventionalControllerSettings.GetSettingOrNull(controllerType);
}
protected virtual AttributeRouteModel CreateAbpServiceAttributeRouteModel(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual AttributeRouteModel CreateAbpServiceAttributeRouteModel(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
{
return new AttributeRouteModel(
new RouteAttribute(
@ -250,7 +249,7 @@ namespace Volo.Abp.AspNetCore.Mvc
);
}
protected virtual string CalculateRouteTemplate(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual string CalculateRouteTemplate(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
{
var controllerNameInUrl = NormalizeUrlControllerName(rootPath, controllerName, action, httpMethod, configuration);
@ -279,7 +278,7 @@ namespace Volo.Abp.AspNetCore.Mvc
return url;
}
protected virtual string NormalizeUrlActionName(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual string NormalizeUrlActionName(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
{
var actionNameInUrl = HttpMethodHelper
.RemoveHttpMethodPrefix(action.ActionName, httpMethod)
@ -301,7 +300,7 @@ namespace Volo.Abp.AspNetCore.Mvc
);
}
protected virtual string NormalizeUrlControllerName(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] AbpControllerAssemblySetting configuration)
protected virtual string NormalizeUrlControllerName(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
{
if(configuration?.UrlControllerNameNormalizer == null)
{

10
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConventionWrapper.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConventionWrapper.cs

@ -3,16 +3,16 @@ using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
[DisableConventionalRegistration]
public class AbpAppServiceConventionWrapper : IApplicationModelConvention
public class AbpServiceConventionWrapper : IApplicationModelConvention
{
private readonly Lazy<IAbpAppServiceConvention> _convention;
private readonly Lazy<IAbpServiceConvention> _convention;
public AbpAppServiceConventionWrapper(IServiceCollection services)
public AbpServiceConventionWrapper(IServiceCollection services)
{
_convention = services.GetRequiredServiceLazy<IAbpAppServiceConvention>();
_convention = services.GetRequiredServiceLazy<IAbpServiceConvention>();
}
public void Apply(ApplicationModel application)

35
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerOptions.cs

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
using Volo.Abp.Http.Modeling;
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class ConventionalControllerOptions
{
public ConventionalControllerSettingList ConventionalControllerSettings { get; }
public List<Type> FormBodyBindingIgnoredTypes { get; }
public ConventionalControllerOptions()
{
ConventionalControllerSettings = new ConventionalControllerSettingList();
FormBodyBindingIgnoredTypes = new List<Type>
{
typeof(IFormFile)
};
}
public ConventionalControllerOptions Create(Assembly assembly, [CanBeNull] Action<ConventionalControllerSetting> optionsAction = null)
{
var setting = new ConventionalControllerSetting(assembly, ModuleApiDescriptionModel.DefaultRootPath);
optionsAction?.Invoke(setting);
setting.Initialize();
ConventionalControllerSettings.Add(setting);
return this;
}
}
}

6
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerAssemblySetting.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSetting.cs

@ -9,9 +9,9 @@ using Microsoft.AspNetCore.Mvc.Versioning;
using Volo.Abp.Application.Services;
using Volo.Abp.Reflection;
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class AbpControllerAssemblySetting
public class ConventionalControllerSetting
{
[NotNull]
public Assembly Assembly { get; }
@ -47,7 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc
public Action<ApiVersioningOptions> ApiVersionConfigurer { get; set; }
public AbpControllerAssemblySetting([NotNull] Assembly assembly, [NotNull] string rootPath)
public ConventionalControllerSetting([NotNull] Assembly assembly, [NotNull] string rootPath)
{
Check.NotNull(assembly, rootPath);

6
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ControllerAssemblySettingList.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSettingList.cs

@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class ControllerAssemblySettingList : List<AbpControllerAssemblySetting>
public class ConventionalControllerSettingList : List<ConventionalControllerSetting>
{
[CanBeNull]
public AbpControllerAssemblySetting GetSettingOrNull(Type controllerType)
public ConventionalControllerSetting GetSettingOrNull(Type controllerType)
{
return this.FirstOrDefault(controllerSetting => controllerSetting.ControllerTypes.Contains(controllerType));
}

8
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/IAbpServiceConvention.cs

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public interface IAbpServiceConvention : IApplicationModelConvention
{
}
}

2
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/UrlActionNameNormalizerContext.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/UrlActionNameNormalizerContext.cs

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class UrlActionNameNormalizerContext
{

2
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/UrlControllerNameNormalizerContext.cs → src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/UrlControllerNameNormalizerContext.cs

@ -1,4 +1,4 @@
namespace Volo.Abp.AspNetCore.Mvc
namespace Volo.Abp.AspNetCore.Mvc.Conventions
{
public class UrlControllerNameNormalizerContext
{

8
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/IAbpAppServiceConvention.cs

@ -1,8 +0,0 @@
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Volo.Abp.AspNetCore.Mvc
{
public interface IAbpAppServiceConvention : IApplicationModelConvention
{
}
}

5
src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs

@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.EntityFrameworkCore;
using Microsoft.Examples;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -90,12 +89,12 @@ namespace Volo.Abp.Identity.HttpApi.Host
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.AppServiceControllers.Create(typeof(AbpIdentityHttpApiHostModule).Assembly, o =>
options.ConventionalControllers.Create(typeof(AbpIdentityHttpApiHostModule).Assembly, o =>
{
o.TypePredicate = t => t == typeof(CallsController);
});
options.AppServiceControllers.Create(typeof(AbpIdentityHttpApiHostModule).Assembly, o =>
options.ConventionalControllers.Create(typeof(AbpIdentityHttpApiHostModule).Assembly, o =>
{
o.TypePredicate = t => t == typeof(Host.VersioningTests.V2.CallsController);
o.RootPath = "app/compat";

10
src/Volo.Abp.Identity.HttpApi.Host/SwaggerDefaultValues.cs

@ -1,9 +1,9 @@
namespace Microsoft.Examples
{
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Linq;
using System.Linq;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace Volo.Abp.Identity.HttpApi.Host
{
/// <summary>
/// Represents the Swagger/Swashbuckle operation filter used to document the implicit API version parameter.
/// </summary>

4
src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/AbpIdentityHttpApiModule.cs

@ -15,14 +15,14 @@ namespace Volo.Abp.Identity
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.AppServiceControllers.Create(typeof(AbpIdentityApplicationModule).Assembly, opts =>
options.ConventionalControllers.Create(typeof(AbpIdentityApplicationModule).Assembly, opts =>
{
opts.RootPath = "identity";
opts.UrlControllerNameNormalizer = context => context.ControllerName.RemovePreFix("Identity");
opts.ApiVersions.Add(new ApiVersion(2, 0));
});
options.AppServiceControllers.Create(typeof(AbpIdentityHttpApiModule).Assembly);
options.ConventionalControllers.Create(typeof(AbpIdentityHttpApiModule).Assembly);
});
}
}

2
test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs

@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.AppServiceControllers.Create(typeof(TestAppModule).Assembly, opts =>
options.ConventionalControllers.Create(typeof(TestAppModule).Assembly, opts =>
{
opts.UrlActionNameNormalizer = context =>
string.Equals(context.ActionNameInUrl, "phone", StringComparison.OrdinalIgnoreCase)

4
test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs

@ -25,14 +25,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
//2.0 Version
options.AppServiceControllers.Create(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly, opts =>
options.ConventionalControllers.Create(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly, opts =>
{
opts.TypePredicate = t => t.Namespace == typeof(Volo.Abp.AspNetCore.Mvc.Versioning.App.TodoAppService).Namespace;
opts.ApiVersions.Add(new ApiVersion(2, 0));
});
//1.0 Compatability version
options.AppServiceControllers.Create(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly, opts =>
options.ConventionalControllers.Create(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly, opts =>
{
opts.TypePredicate = t => t.Namespace == typeof(Volo.Abp.AspNetCore.Mvc.Versioning.App.Compat.TodoAppService).Namespace;
opts.ApiVersions.Add(new ApiVersion(1, 0));

Loading…
Cancel
Save