EasyOC.ReplaceAction 0.0.9-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.9-preview                
NuGet\Install-Package EasyOC.ReplaceAction -Version 0.0.9-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.9-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.9-preview                
#r "nuget: EasyOC.ReplaceAction, 0.0.9-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.9-preview&prerelease

// Install EasyOC.ReplaceAction as a Cake Tool
#tool nuget:?package=EasyOC.ReplaceAction&version=0.0.9-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);
            }
        });
    });
    //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 63 4/28/2024
1.3.4 189 10/13/2023
1.3.0 415 4/19/2023
1.2.1 232 4/16/2023
1.2.0 248 4/9/2023
1.1.0 335 3/4/2023
1.0.13 314 2/25/2023
1.0.13-preview-4 165 2/23/2023
1.0.12 292 2/23/2023
1.0.11 297 2/23/2023
1.0.10 323 2/18/2023
1.0.9 315 2/18/2023
1.0.8 341 2/18/2023
1.0.7 341 2/11/2023
1.0.2 339 2/10/2023
1.0.1 383 1/30/2023
0.1.1 316 1/30/2023
0.1.1-preview 174 1/30/2023
0.0.9-preview 160 1/30/2023
0.0.7-preview 143 1/30/2023
0.0.6-preview 161 1/30/2023
0.0.5-preview 153 1/30/2023
0.0.4-preview 145 1/29/2023
0.0.3-preview 154 1/29/2023
0.0.2-preview 150 1/29/2023
0.0.1-preview 138 1/29/2023