Volcore Documentation

website·Indexed 31 days ago

http://doc.volcore.xyz

Developer documentation for the Volcore framework, covering frontend components like vol-table and volform, and backend C# development. Includes guides on EF Core transactions, Dapper integration, service layer extensions for CRUD operations, audit workflows, and API configuration using JsonNormal.

Tokens
156.7K
Snippets
680
Records
781
Agent score
51%

What's inside Volcore

  1. Overview of VolPro Code Generator

    The VolPro framework relies on a code generator to automate the implementation of basic CRUD and business functions. It supports the automatic generation of frontend and backend code for single tables, master-detail tables, one-to-many relationships, and three-level nested detail tables (Master -> Detail -> Sub-Detail). Generated features include querying, deleting, adding, modifying, importing, exporting, approval workflows, forms, tables, and print data source binding.
  2. vol-table Feature Overview

    The vol-table component supports the following advanced features:

    • Data Binding: Supports both url (API) and tableData (manual) modes.
    • Inline Editing: Supports various input types (text, dropdown, date picker, file upload).
    • Pagination: Built-in pagination with customizable size and info.
    • Sorting & Filtering: Column-level sorting and header-based filtering.
    • Aggregation: Column totals with customizable formats.
    • Tree Structure: Supports tree tables with lazy loading and expansion control.
    • Drag & Drop: Supports row reordering via dragging.
    • Multi-level Headers: Supports complex header configurations.
    • Cross-page Selection: Maintains selection state across different pagination pages.
    • High Performance: tableV2 mode for handling large datasets.
    • Custom Rendering: Use the render function to customize cell content.
    • Fixed Columns: Support for left or right fixed columns.
    • Cell Merging: Custom rules for merging cells.
  3. vol.pro Web Platform Technology Stack

    vol.pro is a cross-platform development framework for Web and Mobile applications. The core technology stack consists of:

    • Frontend: Vue3, Vite, and TypeScript
    • Backend: .NET 8, EFCore 8, and SqlSugar
    • Mobile: Uni-app (supports automatic code generation)
  4. Configure independent databases for different business types

    The system supports 'Business Database Sharding' (业务分库), enabling developers to configure independent databases for different types of business logic. It allows the simultaneous use of multiple database types within a single project—including MySQL, SQL Server, Oracle, and PostgreSQL—and supports automatic code generation for these configurations.
  5. Vol Framework AI Skill Execution Contract

    The AI Skill follows a strict execution contract to ensure business logic is implemented without overwriting generated files or breaking the architecture. The workflow is:

    1. Keyword search for requirements.
    2. Determine target: Backend only, Frontend only, or Full-stack.
    3. Determine UI pattern: If Edit.vue exists, use 'New Page Edit' mode; otherwise, use 'Standard view-grid' ({Table}.vue).
    4. Write to specific files: Partial/{Table}Service.cs, {Table}.vue, Edit.vue, or new SelectXxx.vue components.

    Strict Prohibitions:

    • Do NOT write business logic in .jsx files.
    • Do NOT manually modify options.js.
    • Do NOT modify non-Partial Services or Controllers.
    • Do NOT modify ViewGrid source code.
  6. Configure No-Code Development Mode

    The platform supports a comprehensive No-Code development mode. Key capabilities include:

    • Custom selection sorting.
    • Document coding functions.
    • Data permission management.
    • Custom SQL validation for legality.
    • Initialization parameters consistent with coded development.
  7. Retrieve the previous approval node

    Use the GetTablePreFlowStep() method on a table entity (with a valid primary key) to retrieve information about the previous approval node in the workflow.
    Order order = new Order();
    order.Id = value;
    
    // Get the previous approval node information
    List<Sys_WorkFlowTableStep> steps2 = order.GetTablePreFlowStep();
  8. Understand the view-grid component architecture

    view-grid acts as the master controller for generated pages, managing lifecycle hooks (e.g., onInit, searchBefore, addBefore), page properties, and public methods. It internally renders vol-form and vol-table components to handle the search area, edit forms, main tables, and detail tables. Configuration for these internal components is passed via the options object in the page's .vue file.
    view-grid
    ├── vol-form  ref="searchForm"     ← searchFormFields / searchFormOptions(查询区)
    ├── vol-table ref="table"          ← columns(主表列表)
    └── 编辑弹框 (vol-box)
        ├── vol-form  ref="form"       ← editFormFields / editFormOptions(主表编辑)
        └── vol-table ref="detail"     ← detail.columns / detailOptions(明细,一对多另有 details[])
  9. Deploy the project frontend

    1. Configure the backend API base URL by modifying src\api\http.js. Set axios.defaults.baseURL to the deployed backend address.
    2. Run the build.bat file located in the ../VolPro.vue/ directory. The production-ready files will be generated in the dist folder.
    // In src\api\http.js
    axios.defaults.baseURL = 'http://your-deployed-backend-address';
  10. Database access rules and repository patterns in Vol framework

    Business logic must be implemented in Partial/{Table}Service.cs. Use EF LINQ via the injected repository for database operations. Avoid writing complex LINQ in Controllers. For cross-table operations, inject the required repository into the Service constructor using [ActivatorUtilitiesConstructor].
    public partial class Sys_WorkFlowTableService
    {
        private readonly ISys_WorkFlowTableRepository _repository;
        private readonly ISys_WorkFlowTableStepRepository _stepRepository;
    
        [ActivatorUtilitiesConstructor]
        public Sys_WorkFlowTableService(
            ISys_WorkFlowTableRepository dbRepository, 
            IHttpContextAccessor httpContextAccessor, 
            ISys_WorkFlowTableStepRepository stepRepository)
            : base(dbRepository)
        {
            _repository = dbRepository;
            _stepRepository = stepRepository; // Access to other tables
        }
    }
  11. Implement custom main table queries in Service layer

    To customize the data retrieval for a main table, override the GetPageData method in the Partial/{TableName}Service.cs file. You can assign values to various Func/Action properties (defined in ApplicationServiceBase.cs) to control filtering, sorting, and post-processing before calling base.GetPageData(options).
    public override PageGridData<YourEntity> GetPageData(PageDataOptions options)
    {
        // 1. Handle extra parameters passed from the frontend (searchBefore method)
        object extraValue = options.Value;
    
        // 2. Filter or extract specific search parameters from the relative list
        QueryRelativeList = (List<SearchParameters> parameters) =>
        {
            foreach (var item in parameters)
            {
                if (item.Name == "TargetField")
                {
                    string value = item.Value;
                    item.Value = null; // Clearing the value prevents the framework from using it automatically
                }
            }
        };
    
        // 3. Define custom query expressions (IQueryable for EF, ISugarQueryable for SqlSugar)
        QueryRelativeExpression = (IQueryable<YourEntity> queryable) =>
        {
            // Example: Filter by current user
            queryable = queryable.Where(x => x.CreateID == UserContext.Current.UserId);
            // Example: Include related detail tables
            queryable = queryable.Include(x => x.DetailTable);
            return queryable;
        };
    
        // 4. Specify multiple fields for sorting
        OrderByExpression = x => new Dictionary<object, QueryOrderBy>() {
            { x.CreateDate, QueryOrderBy.Desc },
            { x.PhoneNo, QueryOrderBy.Asc }
        };
    
        // 5. Perform operations on the result set before returning to the page
        GetPageDataOnExecuted = (PageGridData<YourEntity> grid) =>
        {
            List<YourEntity> rows = grid.rows;
        };
    
        var res = base.GetPageData(options);
        // Optional: Add extra data to be received by frontend searchAfter(rows, res)
        res.extra = new { CustomValue = 123 };
        return res;
    }
  12. Customize content in detail tables

    To customize the content of a detail table, you can implement logic in either Vue 3 or Vue 2 depending on your project setup. For Vue 3, use data slotting directly within the generated .vue file. For Vue 2, implement the logic within the methods section of the generated .jsx file.