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
<PackageReference Include="Rhetos.MvcModelGenerator" Version="6.0.0" />
<PackageVersion Include="Rhetos.MvcModelGenerator" Version="6.0.0" />
<PackageReference Include="Rhetos.MvcModelGenerator" />
paket add Rhetos.MvcModelGenerator --version 6.0.0
#r "nuget: Rhetos.MvcModelGenerator, 6.0.0"
#:package Rhetos.MvcModelGenerator@6.0.0
#addin nuget:?package=Rhetos.MvcModelGenerator&version=6.0.0
#tool nuget:?package=Rhetos.MvcModelGenerator&version=6.0.0
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:
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 exampleCaptions.en-GB.resx
orCaptions.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.
- Make sure to set the same properties in Visual Studio for the localized resource file as for the default
- 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:
- 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
andTest.bat
. - The build output is a NuGet package in the "Install" subfolder.
Product | Versions 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. |
-
net8.0
- Rhetos.CommonConcepts (>= 6.0.0)
- Rhetos.MvcModelGenerator.Client (>= 6.0.0)
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.