Browse Source

Handle 2+ level module name on AppServiceControllers.CreateFor

pull/113/head
Halil İbrahim Kalkan 9 years ago
parent
commit
25606b41d6
  1. 2
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs
  2. 10
      src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs

2
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs

@ -41,7 +41,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{
controller.ControllerName = controller.ControllerName.RemovePostFix(ApplicationService.CommonPostfixes);
configuration?.ControllerModelConfigurer(controller);
ConfigureArea(controller, configuration);
//ConfigureArea(controller, configuration);
ConfigureRemoteService(controller, configuration);
}
else

10
src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs

@ -34,10 +34,12 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
private static void AddModuleScript(StringBuilder script, ModuleApiDescriptionModel module)
{
//TODO: Eleminate repeating module.Name.Replace("/", ".").ToCamelCase() !
//TODO: Remove illegal chars (like '-') from module/controller names!
script.AppendLine($"// module '{module.Name.ToCamelCase()}'");
script.AppendLine("(function(){");
script.AppendLine();
script.AppendLine($" abp.services.{module.Name.ToCamelCase()} = abp.services.{module.Name.ToCamelCase()} || {{}};");
script.AppendLine($"abp.utils.createNamespace(abp, 'services.{module.Name.Replace("/", ".").ToCamelCase()}');");
foreach (var controller in module.Controllers.Values)
{
@ -55,7 +57,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
script.AppendLine(" (function(){");
script.AppendLine();
script.AppendLine($" abp.services.{module.Name.ToCamelCase()}.{controller.ControllerName.ToCamelCase()} = abp.services.{module.Name.ToCamelCase()}.{controller.ControllerName.ToCamelCase()} || {{}};");
script.AppendLine($" abp.services.{module.Name.Replace("/", ".").ToCamelCase()}.{controller.ControllerName.ToCamelCase()} = abp.services.{module.Name.Replace("/", ".").ToCamelCase()}.{controller.ControllerName.ToCamelCase()} || {{}};");
foreach (var action in controller.Actions.Values)
{
@ -72,7 +74,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
var parameterList = ProxyScriptingJsFuncHelper.GenerateJsFuncParameterList(action, "ajaxParams");
script.AppendLine($" // action '{action.NameOnClass.ToCamelCase()}'");
script.AppendLine($" abp.services.{module.Name.ToCamelCase()}.{controller.ControllerName.ToCamelCase()}{ProxyScriptingJsFuncHelper.WrapWithBracketsOrWithDotPrefix(action.NameOnClass.ToCamelCase())} = function({parameterList}) {{");
script.AppendLine($" abp.services.{module.Name.Replace("/", ".").ToCamelCase()}.{controller.ControllerName.ToCamelCase()}{ProxyScriptingJsFuncHelper.WrapWithBracketsOrWithDotPrefix(action.NameOnClass.ToCamelCase())} = function({parameterList}) {{");
script.AppendLine(" return abp.ajax($.extend(true, {");
AddAjaxCallParameters(script, controller, action);

Loading…
Cancel
Save