NeuCharFramework (NCF)
  • NCF - NeuCharFramework
  • Projects

    • Preparation
    • NcfPackageSources Source Guide
    • DynamicWebApiEngine
    • Deployment
  • Help

    • Online Resources
    • Q&A Community
    • QQ Group (147054579)
    • Senparc WeChat SDK
  • Gitee
  • GitHub
  • English
  • 简体中文
GitHub
  • NCF - NeuCharFramework
  • Projects

    • Preparation
    • NcfPackageSources Source Guide
    • DynamicWebApiEngine
    • Deployment
  • Help

    • Online Resources
    • Q&A Community
    • QQ Group (147054579)
    • Senparc WeChat SDK
  • Gitee
  • GitHub
  • English
  • 简体中文
GitHub
  • Quickstart And Capability Guide

    • NcfPackageSources Beginner Quickstart (60 Minutes)
    • NcfPackageSources Source Guide
    • NCF Capability Deep Dive (Practical)
    • Version Upgrade Notes
  • XNCF Extension Modules

    • XNCF Extension Library Guide (Senparc.Xncf.xxx)
  • NCF Libraries

    • Senparc.Ncf.Core
    • Senparc.Ncf.Database (Database Foundation)
    • Senparc.Ncf.Repository
    • Senparc.Ncf.Service
    • Senparc.Ncf.SMS
    • Senparc.Ncf.Mvc.UI
    • Senparc.Ncf.Log
    • Senparc.Ncf.Utility
    • Senparc.Ncf.XncfBase
    • Senparc.Ncf.AreaBase
    • Senparc.Ncf.DatabasePlant
  • Core Interfaces

    • IXncfRegister Interface (Current)

IXncfRegister Interface (Current)

Baseline: src/Basic/Senparc.Ncf.XncfBase/Interfaces/IXncfRegister.cs (current version)

1. Contract Responsibility

IXncfRegister is the module registration contract for each XNCF module. It defines:

  • module metadata (Name/Uid/Version/MenuName/Icon/Description)
  • module lifecycle hooks
  • AutoMapper mapping hooks
  • module thread information
  • MCP enablement and registration hooks

2. Key Properties

bool IgnoreInstall { get; }
bool EnableMcpServer { get; }
string Name { get; }
string Uid { get; }
string Version { get; }
string MenuName { get; }
string Icon { get; }
string Description { get; }
ConcurrentBag<Action<Profile>> AutoMapMappingConfigs { get; set; }
IEnumerable<KeyValuePair<ThreadInfo, Thread>> RegisteredThreadInfo { get; }

3. Key Methods

Task InstallOrUpdateAsync(IServiceProvider serviceProvider, InstallOrUpdate installOrUpdate);
Task UninstallAsync(IServiceProvider serviceProvider, Func<Task> unsinstallFunc);

string GetAreaHomeUrl();
string GetAreaUrl(string path);

IServiceCollection AddXncfModule(IServiceCollection services, IConfiguration configuration, IHostEnvironment env);
void AddAutoMapMapping(Action<Profile> mapping);
void OnAutoMapMapping(IServiceCollection services, IConfiguration configuration);

IApplicationBuilder UseXncfModule(IApplicationBuilder app, IRegisterService registerService);

void AddMcpServer(IServiceCollection services, IXncfRegister xncfRegister);
void UseMcpServer(IApplicationBuilder app, IRegisterService registerService);

4. Implementation Notes (Important)

  • IList<Type> Functions is commented out in the current contract and should not be treated as the primary registration path.
  • The recommended function model is [FunctionRender] scanning on AppService methods.
  • AddXncfModule includes IHostEnvironment env in the method signature.
  • MCP members are part of the contract (EnableMcpServer, AddMcpServer, UseMcpServer).

5. Recommended Implementation Pattern

For new modules, inherit from XncfRegisterBase and override only required points:

  • metadata
  • install/uninstall behavior
  • DI registration in AddXncfModule
  • middleware/static resource registration in UseXncfModule
  • MCP enablement via EnableMcpServer => true when needed
Edit this page on GitHub
Last Updated:
Contributors: Jeffrey Su, JeffreySu