Rhetos.MvcModelGenerator 6.0.0

Prefix Reserved
dotnet add package Rhetos.MvcModelGenerator --version 6.0.0
                    
NuGet\Install-Package Rhetos.MvcModelGenerator -Version 6.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rhetos.MvcModelGenerator" Version="6.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rhetos.MvcModelGenerator" Version="6.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Rhetos.MvcModelGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rhetos.MvcModelGenerator --version 6.0.0
                    
#r "nuget: Rhetos.MvcModelGenerator, 6.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rhetos.MvcModelGenerator@6.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rhetos.MvcModelGenerator&version=6.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Rhetos.MvcModelGenerator&version=6.0.0
                    
Install as a Cake Tool

MvcModelGenerator

MvcModelGenerator is a plugin package for Rhetos development platform. It automatically generates ASP.NET MVC model for all entities and other queryable data structures that are defined in a Rhetos application.

See rhetos.org for more information on Rhetos.

Contents:

  1. Features and usage instructions
    1. MVC model classes
    2. Captions resource file
    3. Overriding default captions and localization
    4. Extending heuristics for default captions
  2. Installation and configuration
  3. How to contribute
    1. Building and testing the source code

Features and usage instructions

MvcModelGenerator package, when deployed, generates source and binary files in \bin\Generated folder inside Rhetos server. Include the generated files in your ASP.NET MVC application (or any other), for faster GUI development and easier integration with Rhetos application server.

MVC model classes

  • Rhetos.Mvc.cs contains MVC model classes for Rhetos entities and other data structures.
  • The generated classes and their properties have standard ComponentModel.DataAnnotations attributes based on CommonConcepts features in DSL scripts: Required, UIHint, MaxLength, MinLength, RegularExpression and Display.
  • Custom attributes are also assigned for additional functionality: MaxValue, MinValue, RenderMode and LocalizedDisplayName.
  • If you want to add implemented interfaces defined in DSL using Implements DSL concept, add ImplementInMvcModel concept to Implements:
Implements 'MyNamespace.ITheInteface, MyAssembly' { ImplementInMvcModel; }

Captions resource file

  • The generated Captions.resx resource file contains default captions (display names) for properties, entities and other data structures. The MVC model classes are bound to the resource file by Display attribute.
  • Option A: To use the generated captions include Captions.dll into your web application.
  • Option B: Include Captions.resx into your web application project. Make sure to set the file's properties in Visual Studio to match the following:
    • Custom Tool Namespace: Rhetos.Mvc
    • Build Action: Embedded Resource (default value)
    • Custom Tool: ResXFileCodeGenerator (default value) or PublicResXFileCodeGenerator

Overriding default captions and localization

  • To override default captions, include Captions.resx directly into your project (see the instructions above) and add a new resource file with your culture's name (for example Captions.en-GB.resx or Captions.hr-HR.resx, see CurrentCulture). The ASP.NET will automatically use the captions you entered in the culture-specific resource file, or fallback to the default captions if the localized caption is not entered.
    • Make sure to set the same properties in Visual Studio for the localized resource file as for the default Captions.resx file.
  • There are free resx editors to help you enter the captions.

Extending heuristics for default captions

  • MvcModelGenerator includes CamelCase splitter plugin (CamelCaseCaptions) that splits property names into words when generating default captions, reducing the need to override default captions.
  • Similar caption processing plugins may be implemented in a Rhetos package by implementing ICaptionsValuePlugin interface.

Installation and configuration

Installing this package to a Rhetos application:

  1. Add "Rhetos.MvcModelGenerator" NuGet package, available at the NuGet.org on-line gallery.

How to contribute

Contributions are very welcome. The easiest way is to fork this repo, and then make a pull request from your fork. The first time you make a pull request, you may be asked to sign a Contributor Agreement. For more info see How to Contribute on Rhetos wiki.

Building and testing the source code

  • Note: This package is already available at the NuGet.org online gallery. You don't need to build it from source in order to use it in your application.
  • To build the package from source, run Clean.bat, Build.bat and Test.bat.
  • The build output is a NuGet package in the "Install" subfolder.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rhetos.MvcModelGenerator:

Package Downloads
Rhetos.OmegaCommonConcepts

This package is a plugin for Rhetos development platform.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.0 115 9/4/2025
5.0.0 2,909 3/25/2022
3.1.0 1,206 10/19/2020
3.0.0 1,073 9/23/2020
2.5.0 1,407 5/14/2020
2.4.0 1,327 9/16/2019
2.3.0 1,187 9/9/2019
2.1.0 2,812 11/10/2016