Coalesce

website·Indexed 30 days ago

https://intellitect.github.io/Coalesce/

A code generation framework designed to provide Create, Read, Update, and Delete (CRUD) functionality. It features C# data annotations for model decoration, support for OpenAPI/Swagger, and a Vue/Vuetify component library including specialized UI elements like c-admin-editor and c-list-page for interacting with generated API endpoints.

Tokens
50.5K
Snippets
201
Records
333
Agent score
75%

What's inside Coalesce

  1. Overview of Custom DTOs in Coalesce

    Custom DTOs allow developers to create a custom implementation of IClassDto with specific properties, exposing it as a first-class CRUD Model type. They support all standard CRUD Model features but require manual mapping logic.

    When to use Custom DTOs vs Standalone Entities:

    • Use Custom DTOs when: You need complex mapping logic that is difficult to represent in an EF query expression, or you want to perform Create/Update/Delete operations without writing a separate Behaviors class.
    • Use Standalone Entities when: You need a read-only use case, need to base the model on multiple EF Entities, or require property-level Security Attributes and [DtoIncludes]/[DtoExcludes] (which Custom DTOs do not support natively).
  2. Overview of the Coalesce Vue stack architecture

    The Coalesce Vue stack is designed for building modern web applications using Vite and ES Modules. It integrates with Vue.js and component frameworks like Vuetify. The core functionality is provided by the coalesce-vue NPM package, which should be kept in sync with the corresponding IntelliTect.Coalesce NuGet packages.
  3. Overview of the Coalesce Framework

    Coalesce is a rapid-development, code generation-based web application framework created by IntelliTect. It automates the creation of mundane application components, allowing developers to focus on the data model, business logic, external integrations, page content, site design, and custom scripting.

    The framework is built on the following technology stack:

    • Backend: C#, .NET, and ASP.NET Core.
    • Data Access: Entity Framework (used to generate extensible CRUD APIs).
    • Frontend Language: TypeScript (provides Intellisense and type safety).
    • Frontend Framework: Vue.js (provides data binding and interactivity).
    • Build Tooling: Vite (handles frontend development and build processes, integrated with ASP.NET Core for streamlined local development via dotnet run).
  4. Understand DTO types in Coalesce

    Data Transfer Objects (DTOs) in Coalesce are used to transform data from the data store into a leaner format for client-side use, typically by trimming properties or flattening structures. Coalesce provides two types of DTOs:

    1. Generated DTOs: Automatically created by the Coalesce code generator for every entity model, standalone entity, and external type.
    2. Custom DTOs: Manually created by the developer for specific requirements.
  5. Use c-select-values for multi-select non-object values

    The c-select-values component is a multi-select input designed for collections of non-object values, such as strings and numbers. While available for direct use, it is highly recommended to use the c-input component instead, which can automatically delegate to c-select-values when appropriate.
    <c-select-values 
        :model="post.setTags.args" 
        for="Post.methods.setTags.params.tagNames" 
    />
  6. Understand Class vs Property Security in Coalesce

    Coalesce distinguishes between class-level and property-level security:

    • Class-level security: Enforced in the generated API Controllers using [Authorize] attributes on generated actions. It affects standard API endpoints (e.g., /get, /list, /save) and bulk save endpoints. It does NOT affect the type when used as a navigation property on another type.
    • Property-level security: Enforced within the generated C# DTOs. It controls whether a specific property is read or written regardless of which endpoint is being called.
  7. Understand the Vue Model Layer structure

    The model layer is generated as models.g.ts and contains TypeScript interfaces representing client-exposed types from the data model. Each interface includes all properties of that type and a $metadata property used for type identity. While TypeScript classes are provided for easy instantiation, they are optional as the system relies on the $metadata property rather than instanceof checks.
  8. Restrict Coalesce API endpoint capabilities

    Coalesce provides several techniques to restrict the capabilities of generated API endpoints based on the target feature (CRUD operations, Methods, Services, or Properties). Restrictions can be applied via security attributes, access modifiers, or custom data source overrides.
    FeatureRestrictionTechnique
    CRUD Reads (/get, /list, /count)Disable[Read(DenyAll)]
    CRUD ReadsRole-based[Read("RoleName")]
    CRUD Mutations (/save, /bulkSave, /delete)Disable[Create(DenyAll)], [Edit(DenyAll)], [Delete(DenyAll)]
    CRUD MutationsRole-based[Create("Role")], [Edit("Role")], [Delete("Role")]
    Methods and ServicesRole-based[Execute("RoleName")]
    PropertiesGlobally Exclude[InternalUse] or internal access modifier
    PropertiesRead-onlyInternal setter, no setter, or [Read] attribute without [Edit]
  9. Use c-input for dynamic data-type input delegation

    The c-input component automatically selects the appropriate input UI component based on the type of the bound value. It supports the following mappings:

    • String: Uses v-text-field. If the textarea attribute is provided or [DataType(DataType.MultilineText)] is present in C#, it uses v-textarea. Special DataTypeAttribute values (EmailAddress, PhoneNumber, Password, Color) apply specific field adjustments. Multiple strings use c-select-values.
    • Number: Uses v-text-field (Single) or c-select-values (Multiple).
    • Boolean: Uses v-switch. If the checkbox attribute is provided, it uses v-checkbox.
    • Enum(s): Uses v-select.
    • File(s): Uses v-file-input.
    • Date/Time: Uses c-datetime-picker.
    • CRUD Model(s): Uses c-select (Single/Multiple) or c-select-many-to-many for [ManyToMany] relationships.

    If a type is unsupported, c-input falls back to c-display unless a default slot is provided.