EasyOC.ReplaceAction 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasyOC.ReplaceAction --version 0.1.1                
NuGet\Install-Package EasyOC.ReplaceAction -Version 0.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyOC.ReplaceAction" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyOC.ReplaceAction --version 0.1.1                
#r "nuget: EasyOC.ReplaceAction, 0.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasyOC.ReplaceAction as a Cake Addin
#addin nuget:?package=EasyOC.ReplaceAction&version=0.1.1

// Install EasyOC.ReplaceAction as a Cake Tool
#tool nuget:?package=EasyOC.ReplaceAction&version=0.1.1                

Replace the implementation of the specified controller action in OrchardCore

  1. Add package reference
dotnet add package EasyOC.ReplaceAction
  1. Enable the EasyOC.ReplaceAction feature image
  2. Replace the controller in OrchardCore with your own controller method

update your module's Startup.cs

public override void ConfigureServices(IServiceCollection services)
{
    //sample 1
    services.ReplaceAction<AccountController, EocAccountController>(nameof(EocAccountController.Login));
    //sample 2 , Avoid unnecessary package references
    services.ReplaceAction<EocAccountController>("OrchardCore.Users.Controllers.AccountController", "Login");
    //sample 3 , mapping diffrent name
    services.ReplaceAction<EocAccountController>("OrchardCore.Users.Controllers.AccountController", "ExternalLogin", "MyExternalLogin");

    //sample 4 , Advanced configuration
    services.ReplaceAction(opt =>
    {
        var type = typeof(EocAccountController);

        opt.Items.Add(new ActionReplaceOptionItem
        {
            TargetControllerFullName = typeof(AccountController).FullName,
            NewController = type,
            ActionMapping = new Dictionary<string, MethodInfo> { ["ExternalLogin"] = type.GetMethod("ExternalLogin") }
        });
    });
    //sample 5 , Advanced configuration
    services.ReplaceAction(opt =>
    {
        opt.Items.Add(new ActionReplaceOptionItem
        {
            CustomAction = (descriptor) =>
            {
                //Do whatever you want
                Console.WriteLine(descriptor.ControllerName);
            }
        });
    });
    //sample 6 
            services.ReplaceActionByActionNames<EocAccountController>(
                typeof(AccountController).FullName, 
                nameof(EocAccountController.LinkLoginCallback),
                nameof(EocAccountController.ExternalLogins),
                nameof(EocAccountController.LinkExternalLogin),
                nameof(EocAccountController.ExternalLoginCallback),
                nameof(EocAccountController.RegisterExternalLogin)
                );
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EasyOC.ReplaceAction:

Package Downloads
EasyOC.Users

This repositry is referencing a stable build of OrchardCore (1.8.0). Please give me a start if you find the module helpful, thanks. https://github.com/EasyOC/EasyOC.Modules 如果您认为该模块对你有帮助,请给我一个start ,谢谢 https://github.com/EasyOC/EasyOC.Modules 国内用户 欢迎加入QQ 群:877196442

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.8.0-preview.1 61 4/28/2024
1.3.4 187 10/13/2023
1.3.0 413 4/19/2023
1.2.1 230 4/16/2023
1.2.0 246 4/9/2023
1.1.0 333 3/4/2023
1.0.13 312 2/25/2023
1.0.13-preview-4 163 2/23/2023
1.0.12 290 2/23/2023
1.0.11 295 2/23/2023
1.0.10 321 2/18/2023
1.0.9 313 2/18/2023
1.0.8 339 2/18/2023
1.0.7 339 2/11/2023
1.0.2 337 2/10/2023
1.0.1 381 1/30/2023
0.1.1 314 1/30/2023
0.1.1-preview 172 1/30/2023
0.0.9-preview 158 1/30/2023
0.0.7-preview 141 1/30/2023
0.0.6-preview 159 1/30/2023
0.0.5-preview 151 1/30/2023
0.0.4-preview 143 1/29/2023
0.0.3-preview 152 1/29/2023
0.0.2-preview 148 1/29/2023
0.0.1-preview 136 1/29/2023