RSCG_Templating 2023.1221.1857

dotnet add package RSCG_Templating --version 2023.1221.1857
NuGet\Install-Package RSCG_Templating -Version 2023.1221.1857
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="RSCG_Templating" Version="2023.1221.1857" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RSCG_Templating --version 2023.1221.1857
#r "nuget: RSCG_Templating, 2023.1221.1857"
#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.
// Install RSCG_Templating as a Cake Addin
#addin nuget:?package=RSCG_Templating&version=2023.1221.1857

// Install RSCG_Templating as a Cake Tool
#tool nuget:?package=RSCG_Templating&version=2023.1221.1857

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="2023.1221.1857" OutputItemType="Analyzer"  ReferenceOutputAssembly="false"   />
    <PackageReference Include="RSCG_TemplatingCommon" Version="2023.1221.1857" />
  </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

  1. Template for having the class type name: ClassTypeName
  2. Template for having the class properties as enum : ClassPropByName
  3. Template for setting properties after name : ClassPropByName
  4. Template from DebuggerDisplay for properties: ClassDebuggerDisplay
  5. Template for generating interface from class : ClassInterface
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2023.1221.1857 217 12/21/2023
2023.1022.1748 181 10/22/2023
2023.1022.1722 120 10/22/2023
2023.1007.724 119 10/7/2023
2023.930.2116 116 10/7/2023