EasyOC.ReplaceAction 0.0.7-preview

This is a prerelease version of EasyOC.ReplaceAction.
There is a newer version of this package available.
See the version list below for details.
dotnet add package EasyOC.ReplaceAction --version 0.0.7-preview
NuGet\Install-Package EasyOC.ReplaceAction -Version 0.0.7-preview
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.0.7-preview" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyOC.ReplaceAction --version 0.0.7-preview
#r "nuget: EasyOC.ReplaceAction, 0.0.7-preview"
#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.0.7-preview&prerelease

// Install EasyOC.ReplaceAction as a Cake Tool
#tool nuget:?package=EasyOC.ReplaceAction&version=0.0.7-preview&prerelease

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);
            }
        });
    });
}
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 50 4/28/2024
1.3.4 146 10/13/2023
1.3.0 368 4/19/2023
1.2.1 194 4/16/2023
1.2.0 214 4/9/2023
1.1.0 303 3/4/2023
1.0.13 280 2/25/2023
1.0.13-preview-4 134 2/23/2023
1.0.12 262 2/23/2023
1.0.11 278 2/23/2023
1.0.10 289 2/18/2023
1.0.9 285 2/18/2023
1.0.8 297 2/18/2023
1.0.7 306 2/11/2023
1.0.2 302 2/10/2023
1.0.1 351 1/30/2023
0.1.1 298 1/30/2023
0.1.1-preview 140 1/30/2023
0.0.9-preview 127 1/30/2023
0.0.7-preview 132 1/30/2023
0.0.6-preview 136 1/30/2023
0.0.5-preview 142 1/30/2023
0.0.4-preview 124 1/29/2023
0.0.3-preview 132 1/29/2023
0.0.2-preview 117 1/29/2023
0.0.1-preview 116 1/29/2023