Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>HARIA WebNew to Visual Studio Code? Get it now.
HARIA Web

HARIA Web

ALISoftUA

|
29 installs
| (0) | Free
Create ASP.NET Core MVC applications and REST API facades for HARIA Clean Architecture solutions.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

HARIA Web

HARIA Web

HARIA Web generates ASP.NET Core MVC applications and REST API facades from HARIA domain and service models. It is designed for HARIA Clean Architecture solutions and keeps generated presentation code editable and safe to customize.

Highlights

  • Create an ASP.NET Core MVC project directly from a HARIA .tdm Domain Model.
  • Generate one MVC controller per Entity from the operations implemented by the Application layer.
  • Map standard domain CRUD operations to familiar scaffold actions: Index, Details, Create, Edit, and Delete.
  • Generate editable ViewModels with DataAnnotations while excluding passwords, tokens, collections, and association fields.
  • Generate responsive Razor views using the latest stable Bootstrap 5 release.
  • Configure cookie authentication from a HARIA <User> class and its verified Login operation.
  • Reuse ConnectionStrings:DbConnection from InitializeDB/appsettings.json.
  • Generate and validate Service Model-driven ASP.NET Core REST facades from .smd files.

Requirements

  • Windows, macOS, or Linux (x64 or ARM64).
  • Visual Studio Code 1.90 or newer.
  • The alisoftua.haria extension. VS Code installs it automatically as an extension dependency when it is available in the Marketplace.
  • The .NET 9 SDK available as dotnet. It runs the bundled portable CLI and builds generated HARIA solutions.
  • A HARIA-generated Clean Architecture solution containing its Application, Infrastructure, InitializeDB, and solution files.

HARIA Web runs only in trusted, local workspaces because project creation executes the local dotnet CLI and writes generated files.

Update an MVC web project

Click Update ASP.MVC Core Project, directly below New ASP.MVC Core Project in the HARIA Web Explorer view, or run the command from the palette. Select the MVC project to update. HARIA Web reads its linked .tdm from appsettings.Haria.json; no model or backend selection is needed.

The command regenerates all entity ViewModels, Assemblers, controller pairs and Razor forms, including newly added entities, using the configured directories. It preserves ENABLED regions, manual partials, customized pages and orphaned files, refreshes home navigation, and builds the project. Save pending edits first. Generate the Clean Architecture backend with HARIA when the TDM changes its entities or service contracts. Signed generated pages update automatically; exact HARIA 1.4 templates can be adopted using the previous ViewModel. Missing File storage support is added when required by new forms.

Controllers import the Application Services and MVC Assemblers namespaces and use short names such as ProductoService and ProductoAssembler.ToViewModel(entity). Required imports missing from older protected using regions are added outside those regions, preserving their contents.

Localized decimal form fields

Generated applications default to fixed es-ES, Spanish labels and decimal commas, independently of browser language or culture query strings. The existing floating point binder and validation script remain in use for double, float, decimal, nullables and composition rows. Decimal points and thousands separators are rejected in this profile; JSON and technical route/query parameters remain invariant.

Explicit multilingual applications can set HariaWeb:Localization:EnableCultureSelection to true and configure DefaultCulture/SupportedCultures. An intentional localized GET filter can use [HariaLocalizedNumber] from Utils/Localization; this does not change every query-string parameter. Localization support is emitted under Utils/Localization.

User ViewModel in the web session

Utils/Security/HariaWebClassSession.cs stores independent, typed snapshots for any domain-class ViewModel. Import your Web project's Utils.Security namespace and use HttpContext.Session.SetClass(model), GetClass(), ClearClass() and ClearClasses(). Serialization excludes credentials, hashes, tokens, files and object graphs. Store detached ViewModels.

SetUser/GetUser/ClearUser remain compatibility accessors for the current access snapshot. Cookies and ClaimsPrincipal authenticate requests; snapshots never grant access or roles. Logout clears the snapshots. Register is an explicit self-registration action for the configured security class and signs in only after persistence; Create remains administrative and retains the current operator identity. A failed sign-in after persistence reports that the account already exists. Multiple configured User classes have explicit typed login branches and compound class:id identities; a class name alone never grants a role.

Configure roles explicitly in appsettings.Haria.json when all accounts of a domain user class share those roles:

{
  "HariaWeb": {
    "Authentication": {
      "RolesByUserClass": {
        "Administrador": ["Administrador"],
        "Cliente": ["Cliente"]
      }
    }
  }
}

After credentials are validated and the server entity is loaded, HariaWebAuthentication adds these values as ClaimTypes.Role to the native cookie. [Authorize(Roles = "Administrador")] then uses them; role values are case-sensitive. The default mapping is empty. For per-account roles, implement the trusted AddTrustedClaims partial extension point using serverEntity, rather than assigning a privileged role to the entire class. Protect privileged account creation/editing with the appropriate role policy. After changing role configuration, sign out and sign in again to renew the cookie.

Create an MVC web project

  1. Generate the Clean Architecture backend from the .tdm with HARIA.
  2. Right-click the .tdm and select Create ASP.MVC Core Project, or run HARIA Web: New ASP.MVC Core Project from the Explorer view.
  3. Select one of the generated directories located inside the Domain Model project directory.
  4. Enter the ASP.NET Core project name. The default is <Model>.Web.

Passwords, associations and composition forms

Entity passwords are input-only fields: required on Create, optional on Edit, never populated from the entity or exposed by read Assemblers/Index/Details. Leaving a password blank on Edit keeps the stored hash; Application handles hashing.

File image properties render as bounded thumbnails in Index and as images in Details/Delete. Edit shows the current image with the upload field. URLs resolve from the application base path, including deployments under a URL prefix. Existing generated ViewModels are recognized without requiring a new attribute; new ones include UIHint("HariaImage"). Update the project or regenerate its views to adopt the image display.

Single associations have a typed ID and a select populated from existing entities through Application repositories. The selection is checked on the server, restored on Edit, and reloaded after validation errors. Read views show a label rather than a raw object graph.

Composite collections are composed directly in the entity ViewModel: PedidoViewModel.Lineas is a List<LineaPedidoViewModel>. PedidoAssembler.ToViewModel fills the list through LineaPedidoAssembler.ToViewModel. Inverse parent IDs are optional for nested DTO validation; the parent form assigns the real parent on the server, while standalone line forms validate the required selection. For ExampleDDD, Pedido contains _Lineas.cshtml and _LineasItem.cshtml, with add/remove controls and indexed fields such as Lineas[0].Cantidad. Create/Edit save the parent, selected associations and lines in one Application transaction. Edits check child ownership/duplicate IDs, update existing rows, add new rows and remove orphans. Domain entities are not bound directly from the request.

All form binding errors appear in the validation summary, including obsolete action parameters with no corresponding input. Current Cliente actions receive ClienteViewModel and use model.Password. Scalar persistence failures are logged and returned as form feedback. Update restores exact known generated form properties left in a manual region, and form helpers left outside CRUD, by older versions. Custom members are preserved. Reload the VS Code window after installing an extension update before invoking generation commands.

The generated inline editor handles one collection composition level and scalar/ValueObject row fields with single associations. Optional nested or recursive collections use links to the child's CRUD screens: save the parent first, then select it in the child's association field. Parent edits preserve these collections. This also keeps child passwords in their own forms. Required complex collections and collections without a navigable parent reference still require dedicated transactional actions; generation reports these cases rather than omitting required input. Combined File/relationship forms require dedicated transactional actions. HARIA 1.1.1 loads EF association references and composed rows for read/edit mapping; regenerate existing EF repositories to adopt it. NHibernate uses its existing request session.

AggregateMember operations can live on the aggregate root service. The controller calls the real discovered methods (for example, PedidoService.NewLineaPedidoAsync and ModifyLineaPedidoAsync) and uses the member's Application UnitOfWork repository for transactional reload/save. It does not assume that the root service exposes ReadOIDLineaPedidoDefaultAsync or ModifierLineaPedidoDefaultAsync. The full TiendaAnimales model is compiled from first generation and its member CRUD is checked with EF and NHibernate. HARIA 1.1.2 fixes aggregate-member filter forwarding while retaining the prefixed public service names.

AggregateMember operations can live on the aggregate root service. The controller calls the real discovered methods (for example, PedidoService.NewLineaPedidoAsync and ModifyLineaPedidoAsync) and uses the member's Application UnitOfWork repository for transactional reload/save. It does not assume that the root service exposes ReadOIDLineaPedidoDefaultAsync or ModifierLineaPedidoDefaultAsync. The full TiendaAnimales model is compiled from first generation and its member CRUD is checked with EF and NHibernate. HARIA 1.1.2 fixes aggregate-member filter forwarding while retaining the prefixed public service names.

HARIA Web infers the solution, Application, Infrastructure, and InitializeDB projects. It checks that the backend compiles, verifies the selected login service contract, adds the project references, and creates the Web project beside the other Clean Architecture projects.

New controllers require authentication with [Authorize] at class level. Login and User registration allow anonymous access. Customize policies in the protected action attribute zones; authorization is enforced by MVC on the server.

Database connection

The generated Web project receives ConnectionStrings:DbConnection from InitializeDB/appsettings.json. At generation/migration time, a relative SQLite source is converted to the correct path relative to the Web ContentRoot. Published applications resolve that configured path once and do not search for InitializeDB or the TDM. appsettings.Haria.json supplies base values; environment variables, development secrets and command-line values retain higher precedence.

The selected Infrastructure.csproj determines whether the Web project uses NHibernate or Entity Framework Core. For NHibernate, HARIA Web also adds the database driver package with the version used by InitializeDB.csproj. Untouched generated security registration is refreshed when the ORM or provider changes, including recognized files from earlier releases. A content signature protects customized security registration from replacement; preserved customizations are reported in the output channel. ViewModels, controllers, views, and manual directories retain their existing preservation rules.

NHibernate's UnitOfWorkFactory lives for the application lifetime because it owns the shared ISessionFactory. Its password and token helpers use the same lifetime. Application services remain scoped and create their own units of work and sessions; completing a request does not close the shared session factory. Entity Framework's factory remains scoped with its DbContext.

Business home page

The home page includes Views/Shared/_BusinessNavigation.cshtml. Links are calculated during generation by Roslyn analysis of Controller partials and existing views, including explicit View("OtherName") calls and ActionName aliases. There is no Navigation folder or per-request reflection of actions/views in new projects. CRUD forms, POST-only actions, required input, orphan views and missing destinations are omitted.

The responsive home groups destinations into cards by entity, highlights each list and keeps secondary pages together. Other application pages have their own section. Its scoped styling includes visible keyboard focus and respects reduced-motion preferences.

Use Update Home Page after adding destinations. Keep student links and visibility conditions in the partial's protected manual region. A menu link does not authorize access. Previous unmodified components are retired only as a complete dependency group after their references disappear; customized components or custom references are preserved with a diagnostic. Customized Home/Index.cshtml is preserved. Embed the new navigation with .

Controllers generated from the domain

Initial project creation generates one controller per non-value-object Entity. Standard CRUD operations follow the MVC scaffolding contract:

MVC action Domain operation
Index ReadAll
Details ReadOID
Create New
Edit ReadOID + Modify
Delete ReadOID + Destroy

Read filters, custom and transactional custom operations retain their domain names. The generator resolves real Services and UseCase methods across all Application partials, including manual directories and their actual namespaces. An unavailable operation produces a diagnostic and no fictitious 501 endpoint. Input fields outside the effective create/edit contract are read-only for that operation and produce a diagnostic. Backend defects are reported separately rather than bypassed with arbitrary persistence.

ViewModels and Razor scaffolding

Project creation creates missing ViewModels without overwriting existing files. To update managed code after changing the .tdm, right-click the associated ViewModels directory and choose HARIA Web: Regenerate ViewModels. Right-click a managed Controller to choose HARIA Web: Regenerate Controller, which updates that controller and its companion manual partial. Protected code, orphaned members and unrelated manual files are preserved; unchanged files are not rewritten. Unprotected edits may be replaced with a diagnostic.

Automatic ViewModels expand single-valued ValueObjects into editable scalar fields, including nested components and enumerations. For example, Pedido.total : Moneda becomes TotalValor and TotalTipo. Controllers map these fields for display and reconstruct Domain.ValueObjects.Moneda for creation and editing. Optional ValueObjects have a Has... checkbox and conditional validation, so an absent component remains null. Collections, association roles, passwords and tokens remain excluded, including inside ValueObjects. ValueObjects are composed into their owning Entity and do not get separate controllers.

Open or right-click a ViewModel .cs file and run HARIA Web: Generate Views Scaffolding. Select any combination of Index, Details, Create, Edit, and Delete. Selecting several views retains the existing batch CRUD flow in the MVC project containing that ViewModel. Customized files and destinations with unsaved edits are preserved. The command also works from the active editor and does not ask for a project or TDM again.

When selecting one view, keep its selected template and enter View Name (default: the template name, without .cshtml). Choose one of these modes:

  • Generate view only (use existing action) is the default. For ProductoViewModel and CreateRapido, it creates Views/Producto/CreateRapido.cshtml without touching any Controller. Connect it yourself with return View("CreateRapido", model) in an existing action when appropriate.
  • Generate new action in manual Controller also adds a GET CreateRapido to the same partial Controller class and namespace, in Controllers/manual/ProductoController.Manual.cs (or the corresponding Area), sharing the single manual companion. If it already exists, only the methods are inserted; all existing bytes and attributes are preserved. The extra action is not TDM-managed and is preserved intact. Older standalone Controller.cs partials produced by 1.8 are safely consolidated into this companion.

For Create/Edit forms with a bindable ViewModel, Generate POST action for form is unchecked by default. Selecting it adds a POST with the real ViewModel, ModelState.IsValid and [ValidateAntiForgeryToken]; upload properties stay on the ViewModel. Business calls, persistence, file validation/storage, loading association options and any success redirect remain student TODOs. GET instantiates a simple ViewModel only when its declarations allow it; otherwise it includes an explicit construction/loading TODO. Index uses an empty typed collection. Template type and field generation remain unchanged; renamed form targets use the chosen view/action name.

Review the output paths and confirm Generate. Existing views cannot be overwritten in this flow: choose another name or cancel. Save pending edits first. Duplicate action names, MVC aliases and Async aliases are checked across all project partials, including nested manual folders. Class-level authorization stays effective on the composed Controller; a consistent literal action-level policy is copied when applicable. Mixed/symbolic per-action policies require manual authorization review. No anonymous access or invented role is added.

New actions require a valid, non-generic partial MVC Controller. Explicit route templates/AcceptVerbs, custom/minimal endpoint mappings, conditional Controller declarations or custom inherited Controller bases cause action generation to stop with a diagnostic because route conflicts cannot be safely excluded. Use view-only mode and connect the action manually for these layouts. Literal MVC Areas are supported. Custom Razor view-location conventions and external/linked C# sources require manual integration; explicit Compile items in the project are rejected in action mode. The individual workflow writes only the requested view, missing supporting partials/scripts and optional manual action, with rollback on write failure. It does not refresh home files; run Update Home Page to generate its explicit link.

Guía para alumnos: elige Generate view only para diseñar una interfaz que conectarás a una acción existente. Elige Generate new action in manual Controller para añadir una página independiente del CRUD; completa sus TODO llamando a los servicios de Clean Architecture que necesites. El POST es opcional y no guarda datos hasta que implementes esa operación. La vista nueva y la acción manual no cambian el TDM; conserva tus personalizaciones en Controllers/manual/.

Generated Razor files:

  • use only properties present in the selected ViewModel;
  • exclude password, secret, token, and non-scaffolded properties;
  • use Tag Helpers, validation messages, and anti-forgery tokens;
  • create only missing files and preserve customized files;
  • never write below a manual directory;
  • use responsive Bootstrap cards, forms, and tables.

Uploads and selective regeneration

Domain File attributes persist a string relative path (requires HARIA 1.1.0 or newer). MVC adds an IFormFile upload companion and multipart forms. The generated storage accepts validated PNG/JPEG files up to 5 MiB by default and stores them under wwwroot/uploads/Class/Attribute/PersistentID/random.ext. Edit without a new upload preserves the previous path. Replacement cleanup follows database commit; failed persistence compensates new files. These files are publicly accessible by URL, independently of controller authentication. Existing binary File databases require an explicit migration; no automatic migration runs.

Regeneration uses full-file Roslyn analysis and Clean Architecture /*PROTECTED REGION ID(...) START*/ comments. Add ENABLED before START to protect a block. ViewModels have two blocks: generated properties/validation, followed by manual additions and ValidateAdditional. Controllers have independent per-action attributes and body regions. Signatures, HTTP verbs, ActionName and antiforgery remain regenerable. Standard bodies are unprotected by default; TDM custom bodies in the manual partial are protected by default. Old whole-CRUD/whole-method blocks are structurally migrated, preserving protected annotations and bodies. A protected body out of sync with a changed contract produces a diagnostic. Entirely manual actions remain unchanged.

[Authorize] can protect the entire controller. The main partial includes it by default; both partials provide a class-attribute region for roles/policies. Class attributes apply across both files. Only HARIA's identified manual controller companion can be updated; other manual/ files remain untouched, and collisions with an unrelated manual file abort regeneration. Enum membership and explicit SQL string lengths are validated; business ranges and formats require model metadata or protected additional validation.

Regenerate Controllers is available on the Controllers directory, including associated older projects without the new file header. Regenerate Assemblers is available on the MVC project, ViewModels and Assemblers directories; Regenerate Assembler updates one selected file. First project generation always creates Assemblers/<Entity>Assembler.cs alongside controllers. Index, Details, Edit/Delete GET and entity-returning read filters call ToViewModel directly, including ValueObjects and File forms. Controllers contain no inline entity mapper. Assemblers also provide ApplyToEntity, preserving server IDs, secrets and file paths during reverse mapping. Controller regeneration creates missing required assemblers and preserves existing ones. Assemblers and controllers regenerate independently; older controllers migrate their protections to the new independent action regions.

See the complete implementation guide and test report and generated File example.

REST API facade

Run HARIA Web: Create Project, choose REST API Facade, and select an existing .smd Service Model. HARIA Web validates the model and delegates generation to the bundled HARIA Web CLI.

Privacy

HARIA Web does not collect telemetry or upload source code. Model analysis, generation, and builds run locally. Generated applications reference the jsDelivr Bootstrap CDN unless the project owner replaces those links. See PRIVACY.md.

Support and license

See SUPPORT.md for support information and SECURITY.md for responsible vulnerability reporting. HARIA Web is licensed under GPL-3.0-or-later; see LICENSE.

Build from source

From this directory on Windows, macOS, or Linux:

npm run marketplace:package

This produces the same universal haria-web-1.9.3.vsix artifact on every supported operating system. On Windows, the convenience wrapper is also available:

.\build-install-haria-web.bat

To create the audited public Marketplace artifact without publishing it:

.\prepare-marketplace-release.bat

See the 1.9 simplification and migration report for the H01–H18 changes, before/after examples, tests and backend follow-up issues.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft