RSCG_TemplatingCommon 2024.720.1603
dotnet add package RSCG_TemplatingCommon --version 2024.720.1603
NuGet\Install-Package RSCG_TemplatingCommon -Version 2024.720.1603
<PackageReference Include="RSCG_TemplatingCommon" Version="2024.720.1603" />
paket add RSCG_TemplatingCommon --version 2024.720.1603
#r "nuget: RSCG_TemplatingCommon, 2024.720.1603"
// Install RSCG_TemplatingCommon as a Cake Addin #addin nuget:?package=RSCG_TemplatingCommon&version=2024.720.1603 // Install RSCG_TemplatingCommon as a Cake Tool #tool nuget:?package=RSCG_TemplatingCommon&version=2024.720.1603
RSCG_Templating
Templating for generating everything from classes, methods from a Roslyn Code Generator
Templating is in SCRIBAN form
How to use
Add reference to
<ItemGroup>
<PackageReference Include="RSCG_Templating" Version="2024.720.1603" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageReference Include="RSCG_TemplatingCommon" Version="2024.720.1603" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="ClassTypeName.txt" />
<AdditionalFiles Include="ClassPropByName.txt" />
</ItemGroup>
Then add additional files , for example
//autogenerated by RSCG_Templating version {{data.Version}} from file {{fileName}}
namespace {{data.nameSpace}} {
partial class {{data.className}} {
public string MyTypeName = "{{data.nameSpace}}.{{data.className}}";
}//end class
}//end namespace
Now add
//can have multiple attributes on partial classes
[IGenerateDataFromClass("ClassTypeName")]
public partial class Person
Advanced uses
For the moment , RSCG_Templating generates definition for a class with properties + methods . See example for generating enum from properties and setting properties by name
var x = new Person();
Console.WriteLine("The generated string type is "+x.MyTypeName);
x.FirstName = "Andrei";
//set last name via prop
x.SetPropValue(ePerson_Properties.LastName, "Ignat");
Console.WriteLine("called directly first name : " + x.FirstName);
Console.WriteLine("called via enum of prop first name : " + x.GetPropValue(ePerson_Properties.FirstName));
Console.WriteLine("called get property :" + x.GetPropValue(ePerson_Properties.Name));
See example at https://github.com/ignatandrei/RSCG_Templating/tree/main/src/RSCG_Templating
More templates
- Template for having the class type name: ClassTypeName
- Template for having the class properties as enum : ClassPropByName
- Template for setting properties after name : ClassPropByName
- Template from DebuggerDisplay for properties: ClassDebuggerDisplay
- Template for generating interface from class : ClassInterface
More Roslyn Source Code Generators
You can find more RSCG with examples at Roslyn Source Code Generators
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
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 |
---|---|---|
2024.720.1603 | 111 | 7/20/2024 |
2023.1221.1857 | 241 | 12/21/2023 |
2023.1022.1748 | 189 | 10/22/2023 |
2023.1022.1722 | 173 | 10/22/2023 |
2023.1007.724 | 133 | 10/7/2023 |
2023.930.2116 | 123 | 10/7/2023 |