• Getting Started
    • Prerequisites
    • Download and Installation
    • Change Log
  • Developer Guide
    • EvenCart Plugins
      • Development Environment Setup
      • Plugin Structure
      • EvenCart MVC
      • Dependency Injection
      • Domain Entities
      • Database Versions
      • Plugin Settings
      • Data Provider Plugin
      • Payment Processing Plugin
      • Shipping Provider Plugin
      • Authentication Provider
      • Widget Plugin
    • EvenCart API
      • Authentication
      • Requests & Responses
      • API EndPoints
    • Caching
  • Designer Guide
    • How to create a theme
    • Extended Tags
      • Layout Tag
      • Widget Tag
      • Json Tag
      • Css Tag
      • Js Tag
      • Bundle Tag
      • Partial Tag
      • Control Tag
      • Route Tag
      • Global Tag
      • Component Tag
    • Extended Filters
    • Global Objects
  • Packaging & Distribution

Plugin Settings

Plugin settings are special classes that hold the configuration settings about our plugin. The following document explains how we can create and save settings.

Creating plugin settings

To create settings for our plugin, create a class that implements the interface EvenCart.Core.Config.ISettingGroup. Any class that implements this interface becomes a settings class that can be injected and resolved.

For example, if we are creating an OAuth server based authentication plugin, our setting file could look like as follows.

using EvenCart.Core.Config;
namespace EvenCart.Authentication.OAuthServer
{
    public class OAuthServerSettings : ISettingGroup
    {
        public string ClientId { get; set; }

        public string ClientSecret { get; set; }

        public string RedirectUrl { get; set; }
    }
}

When EvenCart app starts, it scans for all the classes implementing ISettingGroup interface and automatically registers them with the dependency container. The setting class then can be [injected or resolved]() just like any other service.

Saving plugin settings

The service interface EvenCart.Services.Settings.ISettingService is used for saving settings. we can inject or resolve ISettingService and call it's Save method to save settings to database.

_settingService.Save(new OAuthServerSettings(){
    ClientId = "123546",
    ClientSecret = "JKLJ%^&UIOPEW",
    RedirectUrl = "https://mydomain.com/"
});

Next steps

Congrats! We now understand the concepts needed to create our plugins. Next step would be to select the type of plugin we want to create.

  1. Database Access Plugin
  2. Payment Processor Plugin
  3. Widget Plugin
  4. Shipping Provider Plugin
  5. Authentication Provider Plugin
ON THIS PAGE
  • Creating plugin settings
  • Saving plugin settings
  • Next steps

Related Pages

  • Plugin Structure
  • EvenCart MVC
  • Dependency Injection
  • Domain Entities
  • Database Versions
© 2022 Sojatia Infocrafts Pvt. Ltd. All rights reserved. Powered by onlyDoc.