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)

Senparc.Ncf.Repository

Positioning

Senparc.Ncf.Repository is the EF Core-based data access abstraction in NCF. It standardizes query, CRUD, paging, sorting, and transaction primitives for upper layers.

Key Types

  • IRepositoryBase<T>: repository contract
  • RepositoryBase<T>: default implementation
  • IClientRepositoryBase<T> / ClientRepositoryBase<T>: client-side repository abstraction
  • XncfModuleRepository: module metadata repository

Core folders: BaseRepoisitory, System

Capability Overview

IRepositoryBase<T> includes:

  • sync/async conditional querying and paging
  • dynamic order-by field support
  • count/sum aggregation
  • batch save/delete operations
  • transaction lifecycle APIs

Example (paged query):

var page = await _repository.GetObjectListAsync(
    where: x => !x.Flag,
    orderBy: x => x.Id,
    orderingType: OrderingType.Descending,
    pageIndex: 1,
    pageCount: 20);

Collaboration With Service Layer

Avoid scattering complex repository calls directly in controllers/app-services. Prefer wrapping data access in Senparc.Ncf.Service.ServiceBase<T> to keep:

  • clear transaction boundaries
  • consistent tenant context
  • unified DTO mapping strategy

Recommendations

  • Keep complex joins and aggregation orchestration in service-level methods.
  • Use explicit transactions for multi-step write workflows.
  • Keep repository layer focused on generic persistence behavior, not business policy.
Edit this page on GitHub
Last Updated:
Contributors: Jeffrey Su, JeffreySu
Prev
Senparc.Ncf.Database (Database Foundation)
Next
Senparc.Ncf.Service