Merge pull request #7816 from abpframework/maliming/ApplicationApiDescriptionModel

Use ApplicationApiDescriptionModel.Create  insetad of new.
pull/8021/head
liangshiwei 5 years ago committed by GitHub
commit 490c96784e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -84,7 +84,6 @@ namespace Volo.Abp.AspNetCore.Mvc
); );
var controllerModel = moduleModel.GetOrAddController( var controllerModel = moduleModel.GetOrAddController(
controllerType.FullName,
_options.ControllerNameGenerator(controllerType, setting), _options.ControllerNameGenerator(controllerType, setting),
controllerType, controllerType,
_modelOptions.IgnoredInterfaces _modelOptions.IgnoredInterfaces

@ -43,7 +43,7 @@ namespace Volo.Abp.Http.Modeling
public ApplicationApiDescriptionModel CreateSubModel(string[] modules = null, string[] controllers = null, string[] actions = null) public ApplicationApiDescriptionModel CreateSubModel(string[] modules = null, string[] controllers = null, string[] actions = null)
{ {
var subModel = new ApplicationApiDescriptionModel(); var subModel = ApplicationApiDescriptionModel.Create();;
foreach (var module in Modules.Values) foreach (var module in Modules.Values)
{ {

@ -41,17 +41,17 @@ namespace Volo.Abp.Http.Modeling
public ControllerApiDescriptionModel AddController(ControllerApiDescriptionModel controller) public ControllerApiDescriptionModel AddController(ControllerApiDescriptionModel controller)
{ {
if (Controllers.ContainsKey(controller.ControllerName)) if (Controllers.ContainsKey(controller.Type))
{ {
throw new AbpException($"There is already a controller with name: {controller.ControllerName} in module: {RootPath}"); throw new AbpException($"There is already a controller with type: {controller.Type} in module: {RootPath}");
} }
return Controllers[controller.ControllerName] = controller; return Controllers[controller.Type] = controller;
} }
public ControllerApiDescriptionModel GetOrAddController(string uniqueName, string name, Type type, [CanBeNull] HashSet<Type> ignoredInterfaces = null) public ControllerApiDescriptionModel GetOrAddController(string name, Type type, [CanBeNull] HashSet<Type> ignoredInterfaces = null)
{ {
return Controllers.GetOrAdd(uniqueName, () => ControllerApiDescriptionModel.Create(name, type, ignoredInterfaces)); return Controllers.GetOrAdd(type.FullName, () => ControllerApiDescriptionModel.Create(name, type, ignoredInterfaces));
} }
public ModuleApiDescriptionModel CreateSubModel(string[] controllers, string[] actions) public ModuleApiDescriptionModel CreateSubModel(string[] controllers, string[] actions)

Loading…
Cancel
Save