Skip to content

Commit

Permalink
Default replacement rule, changed from ActionName to MethodInfo.Name
Browse files Browse the repository at this point in the history
  • Loading branch information
hyzx86 committed Mar 4, 2023
1 parent ecd68ad commit 5ca1473
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<label class="form-check-label" for="@(Html.IdFor(m => m.Names) + "_" + role.RoleName)">@role.RoleName</label>
<span class="hint">@role.RoleDescription</span>
</div>

</li>
}
</ul>
Expand Down
12 changes: 5 additions & 7 deletions src/Modules/EasyOC.ReplaceAction/ServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,25 @@ public static IServiceProvider UseReplaceAction(this IServiceProvider servicePro
}
else
{

var actionMethodName = descriptor.MethodInfo.Name;
if (descriptor.ControllerTypeInfo.FullName == item.TargetControllerFullName &&
item.ActionMapping.ContainsKey(descriptor.ActionName)
item.ActionMapping.ContainsKey(actionMethodName)
)
{
descriptor.ControllerTypeInfo = item.NewController.GetTypeInfo();
descriptor.MethodInfo = item.ActionMapping[descriptor.ActionName];
descriptor.MethodInfo = item.ActionMapping[actionMethodName];
if (logger != null && logger.IsEnabled(LogLevel.Debug))
{
logger.LogDebug("The Action:{action} of controller:{type} is replaced by {newContorller}.{method}",
item.TargetControllerFullName,
descriptor.ActionName,
actionMethodName,
descriptor.ControllerTypeInfo.FullName,
item.ActionMapping[descriptor.ActionName]
item.ActionMapping[actionMethodName]
);
}
}
}
}


}
return serviceProvider;
}
Expand Down

0 comments on commit 5ca1473

Please sign in to comment.