DotJEM.SourceGen.TemplateGenerator
0.1.12-beta001
This is a prerelease version of DotJEM.SourceGen.TemplateGenerator.
This package has a SemVer 2.0.0 package version: 0.1.12-beta001+sha.cf522dc.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DotJEM.SourceGen.TemplateGenerator --version 0.1.12-beta001
NuGet\Install-Package DotJEM.SourceGen.TemplateGenerator -Version 0.1.12-beta001
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="DotJEM.SourceGen.TemplateGenerator" Version="0.1.12-beta001" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotJEM.SourceGen.TemplateGenerator --version 0.1.12-beta001
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotJEM.SourceGen.TemplateGenerator, 0.1.12-beta001"
#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 DotJEM.SourceGen.TemplateGenerator as a Cake Addin #addin nuget:?package=DotJEM.SourceGen.TemplateGenerator&version=0.1.12-beta001&prerelease // Install DotJEM.SourceGen.TemplateGenerator as a Cake Tool #tool nuget:?package=DotJEM.SourceGen.TemplateGenerator&version=0.1.12-beta001&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Template Source Generater
This is a small C# Source Generater for converting various template files into C# code.
Examples
Person.xml
<person>
<name value="@{name}">
<age value="@{age}">
</person>
Would generate a method with the following signature:
internal static class XmlTemplates {
public static string Person(string name, string age) => ...;
}
Usage:
string result = XmlTemplates.Person("Peter", 42);
-->
<person>
<name value="Peter">
<age value="42">
</person>
Options
The following global options can be used to control the generation process:
Option | Default | Description |
---|---|---|
DotJEMTemplateVisibility | internal | The visibility to use for the templates class, e.g. internal or public |
DotJEMTemplateNamespace | <RootNamespace> | The namespace to to put the templates class under, defaults to the configured RootNamespace |
DotJEMTemplateMethodName | @{name}_@{key}|@{name} | A Template string to use when giving themplates method name, defauls to the Template name or TemplateName_Key for multi template files, parameters are: name or templateName and key or templateKey |
DotJEMTemplateParameterPattern | @{(.+?)} | A Regex pattern for finding parameters in templates |
DotJEMIncludeAllAdditionalFiles | true | By default all files registered with AdditionalFiles are process unless they are explicitly excluded, if this is not desired this can be set to false |
Further each AdditionalFiles node may have these options set:
Option | Default | Description |
---|---|---|
TemplateClass | <file extention> + Templates | The class name to put the templates into, defaults to the file extention in pascal case appended with Templates |
Visibility | <DotJEMTemplateVisibility> | Overrides Global Option: DotJEMTemplateVisibility |
Namespace | <DotJEMTemplateNamespace> | Overrides Global Option: DotJEMTemplateNamespace |
MethodNameTemplate | <DotJEMTemplateParameterPattern> | Overrides Global Option: DotJEMTemplateParameterPattern |
ParameterPattern | <DotJEMTemplateParameterPattern> | Overrides Global Option: DotJEMTemplateParameterPattern |
IsTemplates | <DotJEMIncludeAllAdditionalFiles> | Overrides Global Option: DotJEMIncludeAllAdditionalFiles |
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DotJEM.SourceGen.TemplateGenerator:
Package | Downloads |
---|---|
DotJEM.Json.Storage2
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.13-beta001 | 384 | 5/14/2024 |
0.1.12-beta001 | 32 | 5/14/2024 |
0.1.11-beta001 | 51 | 5/13/2024 |