Skip to content

Commit

Permalink
Merge pull request #7816 from abpframework/maliming/ApplicationApiDes…
Browse files Browse the repository at this point in the history
…criptionModel

Use ApplicationApiDescriptionModel.Create  insetad of new.
  • Loading branch information
realLiangshiwei committed Feb 24, 2021
2 parents 3df1322 + 105d7fd commit 490c967
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public ApplicationApiDescriptionModel CreateApiModel(ApplicationApiDescriptionMo
);

var controllerModel = moduleModel.GetOrAddController(
controllerType.FullName,
_options.ControllerNameGenerator(controllerType, setting),
controllerType,
_modelOptions.IgnoredInterfaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ModuleApiDescriptionModel GetOrAddModule(string rootPath, string remoteSe

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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ public static ModuleApiDescriptionModel Create(string rootPath, string remoteSer

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)
Expand Down

0 comments on commit 490c967

Please sign in to comment.