Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

Repository files navigation

FlowSynx PluginCore

FlowSynx PluginCore is a lightweight, extensible plugin execution framework designed for modular application architecture. It supports structured error handling, versioning, logging, and flexible plugin execution with parameter and specification support.


✨ Features

  • 🔌 Plugin Interface: Define reusable plugins with metadata, specifications, and execution logic.
  • ⚙️ Execution Parameters: Pass dynamic parameters and retrieve results using a standardized dictionary.
  • 📋 Specifications Model: Configure plugins with reusable specifications.
  • 🪵 Plugin Logging: Built-in logger interface with multiple severity levels.
  • 🧪 Versioning System: Compare and manage plugin versions (Major.Minor.Patch).
  • Custom Error Handling: Structured exceptions and codes via FlowSynxException and ErrorMessage.
  • 🏷️ Required Attributes: Decorate required specification fields with RequiredMemberAttribute.

🧩 Core Concepts

✅ IPlugin Interface

The heart of the framework, the IPlugin interface, enforces a contract for plugin implementation:

publicinterfaceIPlugin{PluginMetadataMetadata{get;}PluginSpecifications?Specifications{get;set;}TypeSpecificationsType{get;}TaskInitialize(IPluginLoggerlogger);Task<object?>ExecuteAsync(PluginParametersparameters,CancellationTokencancellationToken);}
  • Metadata: Descriptive data like name, description, author, etc.
  • Specifications: Custom configuration for plugin behavior.
  • SpecificationsType: Strongly typed representation of specifications (with validation).
  • Initialize: Called before execution, typically for setup or validation.
  • ExecuteAsync: The main execution method, receiving input parameters and returning results.

⚙️ Plugin Metadata & Specifications

A case-insensitive dictionary allowing plugins to define required and optional configuration options. Supports deep cloning and dynamic usage:

publicclassPluginSpecifications:Dictionary<string,object?>, ICloneable

Supports [RequiredMember] attribute for validation:

[RequiredMember]publicstringRequiredSetting{get;set;}

Create simple specifications

publicclassMyPluginSpecs:PluginSpecifications{[RequiredMember]publicstringRequiredSetting{get;set;}="default";}

📦 Parameters and Cloning

PluginParameters provides a flexible, case-insensitive dictionary to pass runtime data to plugins:

publicclassPluginParameters:Dictionary<string,object?>, ICloneable

Use .Clone() for safe state reuse.

🛠 Logging

Plugins receive a logging abstraction to emit structured logs:

publicinterfaceIPluginLogger{voidLog(PluginLoggerLevellevel,stringmessage);}

Log Levels

Use the logger with severity levels or extension methods:

publicenumPluginLoggerLevel{Debug,Information,Warning,Error}

Logger Extensions

logger.LogInfo("Started processing...");logger.LogError("An error occurred.");

🧭 Categories Support

To organize plugins by type or domain, use the PluginNamespace enum:

publicenumPluginCategory{AI,Api,Authentication,BusinessIntelligence,Blockchain,Cloud,Communication,Data,Database,DevOps,Finance,ML,Monitoring,Logging,Networking,ProjectWorkflow,ResourcePlanning,Security,Storage,Testing,Web}

🧪 Example Plugin

publicclassSampleGreetingPlugin:IPlugin{publicPluginMetadataMetadata=>new(){Id=Guid.Parse("fc58122d-6444-4c5b-ab3d-8cff62283a08"),Name="MyPlugin",Description="This is a test plugin.",Version=newPluginVersion(1,0,0),Namespace=PluginNamespace.Api,CompanyName="FlowSynx",Authors=newList<string>{"FlowSynx"},Copyright="© FlowSynx. All rights reserved.",Tags=newList<string>(){"MyCompany","TestPlugin"}};publicPluginSpecifications?Specifications{get;set;}publicTypeSpecificationsType=>typeof(GreetingSpecs);publicTaskInitialize(IPluginLoggerlogger){logger.LogInfo("Initializing GreetingPlugin...");returnTask.CompletedTask;}publicTask<object?>ExecuteAsync(PluginParametersparameters,CancellationTokencancellationToken){stringname=parameters.TryGetValue("name",outvarvalue)?value?.ToString()??"World":"World";returnTask.FromResult<object?>($"Hello, {name}!");}}

About

Plugin interface for create new plugin for FlowSynx engine

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages