Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

BasePlugin.cs

namespace Nop.Services.Plugins;

/// 
/// Base plugin
/// 
public abstract partial class BasePlugin : IPlugin
{
    /// 
    /// Gets a configuration page URL
    /// 
    public virtual string GetConfigurationPageUrl()
    {
        return null;
    }

    /// 
    /// Gets or sets the plugin descriptor
    /// 
    public virtual PluginDescriptor PluginDescriptor { get; set; }

    /// 
    /// Install plugin
    /// 
    /// A task that represents the asynchronous operation
    public virtual Task InstallAsync()
    {
        return Task.CompletedTask;
    }

    /// 
    /// Uninstall plugin
    /// 
    /// A task that represents the asynchronous operation
    public virtual Task UninstallAsync()
    {
        return Task.CompletedTask;
    }

    /// 
    /// Update plugin
    /// 
    /// Current version of plugin
    /// New version of plugin
    /// A task that represents the asynchronous operation
    public virtual Task UpdateAsync(string currentVersion, string targetVersion)
    {
        return Task.CompletedTask;
    }

    /// 
    /// Prepare plugin to the uninstallation
    /// 
    /// A task that represents the asynchronous operation
    public virtual Task PreparePluginToUninstallAsync()
    {
        //any can put any custom validation logic here
        //throw an exception if this plugin cannot be uninstalled
        //for example, requires some other certain plugins to be uninstalled first
        return Task.CompletedTask;
    }
}