NeuCharFramework (NCF)
  • NCF - NeuCharFramework
  • Projects

    • Preparation
    • NcfPackageSources Source Guide
    • DynamicWebApiEngine
    • Deployment
    • MCP (Model Context Protocol) Module
    • Senparc.AI
  • 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
    • MCP (Model Context Protocol) Module
    • Senparc.AI
  • Help

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

    • NCF - NeuCharFramework
    • About NCF
    • Environment Requirements
    • Frontend and Backend Separation Mode
    • Introduction to Xncf Modules
  • Prepare Development

    • Get NCF Template Source Code
    • Using Visual Studio to Run NCF
    • Running NCF Using CLI
    • Installation
    • Admin Login
    • Admin Backend
    • appsettings.json Configuration
    • Module Management
    • Accessing Documentation
  • Configuration

    • Entry File
    • Database Settings
    • appsettings.json Configuration
    • Docker
    • Dapr
    • Configure Multi-Tenant
    • Redis Cache
  • Template-Based Development

    • NCF Modular Development Concept
    • XNCF Module Structure
    • XNCF Extension Contracts and Boundaries
    • Create the First Xncf Module
    • Current XNCF Template Structure
    • Implement Your Own Business Logic
    • Update Xncf Module
    • How to Call Between Modules
    • Publish Xncf Module to nuget.org
    • Update Base Library
    • Create a Minimal XNCF Module Manually
    • Embedding Static Resource Files into NCF
    • Publish Local Nuget Package
    • Advanced
  • Database

    • Database Settings
    • Multi-Database Support
    • Specify Database
    • Update database migration files for the Senparc.Service project (Migrations)
    • Multi-Database Principle
    • DatabasePlant
    • Tarmac Operation Database Migration and Update
  • Unit Testing

    • NCF Unit Test Introduction
    • Start Development
    • Advanced
    • Appendix
  • Q&A

    • NCF Terminology
    • NCF FAQ
  • Release

    • New Features
    • Upgrade Guide
    • Logs

XNCF Extension Contracts and Boundaries

This page is for developers building business modules from the NCF Template or XncfBuilder template. It describes supported extension points without explaining the framework's internal scanning, reflection, or execution code.

Choose the right documentation layer

GoalStart here
Create, extend, or publish an XNCF module from a TemplateThis page and the Template-Based Development section
Debug why the framework scans, registers, or executes an interfaceNcfPackageSources Source Guide
Change NCF libraries, synchronize templates, or contribute to official repositoriesProject Relationships, Synchronization, and Release

Most business modules need only the first layer. Framework internals are not a prerequisite.

Required module contract

Every XNCF module needs a register class marked with [XncfRegister], derived from XncfRegisterBase, and implementing IXncfRegister. In normal development, keep the generated Register.cs and customize these members:

Member or methodExtension contract
NameStable unique module name, normally the full namespace
UidGlobally unique and immutable after release; do not regenerate it during upgrades
VersionModule install/upgrade lifecycle version, not the NuGet package version
MenuName, Icon, DescriptionAdmin display metadata, optionally backed by localized resources
InstallOrUpdateAsync()Initialize data, migrate the database, or run compatible upgrades
UninstallAsync()Define removal behavior and an explicit production data-retention policy
AddXncfModule()Register module dependencies, mappings, and application services
UseXncfModule()Mount static files, middleware, and other runtime behavior

Do not add the legacy IXncfFunction or Functions list found in old guides. The current Function entry point is an AppServiceBase method.

Function contract

An executable Function normally consists of:

  1. an application service derived from AppServiceBase;
  2. an executable method marked with [FunctionRender(...)]; and
  3. a request model derived from FunctionAppRequestBase.

Request models can use DataAnnotations, LocalizedDescription, and FunctionParameterUi for validation, localization, and input controls. Use the current NCF public response models. Prefer the pattern generated by the matching template version instead of depending on the internal scanner implementation.

Optional extension interfaces

Not every module needs these capabilities:

RequirementExtension pointTypical template location
Module database and migrationsIXncfDatabaseRegister.Database.cs, Domain/Migrations
Admin Razor AreaIAreaRegisterRegister.Area.cs, Areas/Admin
Razor runtime compilationIXncfRazorRuntimeCompilationImplement only when runtime Razor compilation is required
Module middlewareIXncfMiddlewareImplement on the register class as needed
Long-running background workIXncfThreadUse only for work that needs framework lifecycle management
MCP serverEnableMcpServer => true plus MCP Tool attributesRegister class and Tool classes

Keep generated capabilities that the business needs; do not implement every interface merely for structural completeness. Database uninstall behavior, background threads, and public MCP endpoints require explicit data-safety, shutdown, authentication, and audit decisions.

What Template developers do not need first

These are source-analysis topics, not prerequisites for a business module:

  • how StartNcfEngine() scans assemblies and orders modules;
  • how reflection populates FunctionRenderCollection;
  • how the XNCF base class maps MCP routes;
  • internal multi-database, repository-base, and runtime-composition details;
  • synchronization between the simulated site, NCF repository, and NuGet templates.

When you need to debug or change those behaviors, continue to the NcfPackageSources Source Guide. Otherwise, use the current generated code and public contracts as the authority.

Recommended order

  1. Create your first XNCF module
  2. Current XNCF template structure
  3. Develop an XNCF module
  4. Create a minimal XNCF module manually (only when you need its minimum composition)
Edit this page on GitHub
Last Updated:
Contributors: JeffreySu
Prev
XNCF Module Structure
Next
Create the First Xncf Module