Talrace.Core.ModelGenerator
8.0.1
dotnet add package Talrace.Core.ModelGenerator --version 8.0.1
NuGet\Install-Package Talrace.Core.ModelGenerator -Version 8.0.1
<PackageReference Include="Talrace.Core.ModelGenerator" Version="8.0.1" />
paket add Talrace.Core.ModelGenerator --version 8.0.1
#r "nuget: Talrace.Core.ModelGenerator, 8.0.1"
// Install Talrace.Core.ModelGenerator as a Cake Addin #addin nuget:?package=Talrace.Core.ModelGenerator&version=8.0.1 // Install Talrace.Core.ModelGenerator as a Cake Tool #tool nuget:?package=Talrace.Core.ModelGenerator&version=8.0.1
About
This package is used to generate classes and interfaces based on .NET classes. Currently supports conversion to Typescript, Kotlin and Swift. Typescript classes are strongly typed and can be used in any typescript application. Typescript interfaces can ONLY be used in Angular applications (version 14 or higher) for typed forms (more info here). Kotlin conversion supports optional "@Serializable" annotation. Requires Kotlinx.Serialization package. Kotlin conversion also has optional realmDb support(Realm JavaSDK docs here) Swift conversion can also generate models for RealmDb support (Realm Swift SDK docs here)
Available api
Generator - class is used to remove and create generated typescript models and form interfaces from DTO models. FileHandler - static class is used to deserialize the JSON data into the specified object. GeneratorOptions - class defines data contract fields.
ModelGenerator configuration
To use the ModelGenerator package, you need to add the dependencies used in DTO models. Build a project with models contain and all of its dependencies for find *.Dtos.dll files. configuration.json - used for deserialization into the GeneratorOptions model.
{
"Sources": ["<BuildModelsFilePaths>"],
"TsDestination": "<TypescriptDestinationModelPath>",
"Files": [ "<BuildFiles>" ],
"SkipDayjs": <SkipDayjs>,
"Compiled": "<PathToBin(bin/Debug/net6.0)>",
"SkipTsFormInterfaces": <SkipTsFormInterfaces>,
"KtDestination": "<KotlinDestinationModelPath>",
"KtPackageName": "<KotlinModelsPackageName>",
"KtUseKotlinxSerialization": "<AnnotateModelsAsSerializable(true/false)>",
"KtUseRealmDb": "<AddRealmSupport(true/false)>",
"SwiftDestination": "<SwiftDestinationModelPath>",
"SwiftUseRealmDb": "<AddRealmSupportModels(true/false)>"
}
Generate typescript models and form interfaces.
static void Main(string[] args) {
var options = FileHandler.ReadJson<GeneratorOptions>("<ConfigurationJsonPath>");
var generator = new Generator();
generator.Process(options, args);
}
Run the project through the console by typing dotnet run to generate typescript models. Also you can pass "kt", "swift" or "ts" as space separated arguments to generate kotlin, swift or typescript models respectively. For example: dotnet run kt ts
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. |
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- Talrace.Core.Attributes (>= 8.0.0)
- Talrace.Core.Interfaces (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.1 | 456 | 9/24/2024 |
8.0.0 | 1,443 | 11/30/2023 |
6.0.19 | 468 | 10/9/2023 |
6.0.18 | 164 | 10/5/2023 |
6.0.17 | 379 | 5/23/2023 |
6.0.16 | 142 | 5/23/2023 |
6.0.15 | 1,012 | 4/28/2023 |
6.0.14 | 224 | 4/18/2023 |
6.0.13 | 311 | 3/27/2023 |
6.0.12 | 218 | 3/24/2023 |
6.0.11 | 247 | 3/14/2023 |
6.0.10 | 589 | 3/10/2023 |
6.0.9 | 306 | 3/9/2023 |
6.0.8 | 252 | 3/1/2023 |
6.0.7 | 1,136 | 2/22/2023 |
6.0.6 | 1,059 | 2/17/2023 |
6.0.5 | 251 | 2/9/2023 |
6.0.4 | 508 | 9/30/2022 |
6.0.3 | 427 | 9/8/2022 |
6.0.2 | 569 | 7/22/2022 |
6.0.1 | 3,342 | 5/5/2022 |
6.0.0 | 430 | 4/28/2022 |
3.1.20 | 2,130 | 12/15/2021 |
3.1.19 | 333 | 9/24/2021 |
3.1.13 | 2,252 | 4/9/2021 |
3.1.12 | 747 | 3/2/2021 |
3.1.11 | 602 | 1/4/2021 |
3.1.10 | 496 | 12/17/2020 |
3.1.0 | 3,395 | 4/13/2020 |