WckdRzr.CSharpExporter 0.4.0

.NET 5.0
Suggested Alternatives

WckdRzr.Gaspar

NuGet\Install-Package WckdRzr.CSharpExporter -Version 0.4.0
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.
dotnet add package WckdRzr.CSharpExporter --version 0.4.0
<PackageReference Include="WckdRzr.CSharpExporter" Version="0.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WckdRzr.CSharpExporter --version 0.4.0
#r "nuget: WckdRzr.CSharpExporter, 0.4.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install WckdRzr.CSharpExporter as a Cake Addin
#addin nuget:?package=WckdRzr.CSharpExporter&version=0.4.0

// Install WckdRzr.CSharpExporter as a Cake Tool
#tool nuget:?package=WckdRzr.CSharpExporter&version=0.4.0

C# Exporter

This is a tool that consumes your C# domain models, types and controllers and exports them for other services and languages to consume. Your C# models are available in TypeScript and your controller endpoints are available to TypeScript and other C# services, removing the need to hard code variable names and urls.

It's built from Jonathan Svenheden's C# models to TypeScript project which makes use of the Roslyn (the .NET compiler platform) to parse the source files, which removes the need to create and maintain our own parser.

Supported Conversions

C# Models and Types C# Controllers
Export to TypeScript
Export to Angular
Export to Ocelot Config
Export to C#

Dependencies

Install

Install from NuGet: https://www.nuget.org/packages/WckdRzr.CSharpExporter/

How to use

  1. Add a config file to your project named csharp-exporter.config that contains for example (See /Models/Configuration.cs for the full config model)...
{
	"Models": {
		"Include": [
			"./Models/**/*.cs",
            "./Enums/**/*.cs"
		],
		"Exclude": [
            "./Models/foo/bar.cs"
        ],
	    "Output": [{
			"Type": "TypeScript",
	    	"Location": "./api.d.ts"
	    },{
			"Type": "CSharp",
	    	"Location": "./ServiceComms/Api.cs"
		}],
		"CamelCaseEnums": false,
		"NumericEnums": true,
		"StringLiteralTypesInsteadOfEnums": false
	},
	"Controllers": {
		"Include": [
			"./Controllers/**/*.cs",
		],
		"Exclude": [],
		"Output": [{
			"Type": "Angular",
			"Location": "./service.ts",
			"ModelPath": "./api.d"
		}],
	    "Gateway": "api",
	    "ServiceName": "all"
	},
    "OnlyWhenAttributed": "FrontEnd",
    "CustomTypeTranslations": {
        "ProductName": "string",
        "ProductNumber": "string"
    }
}
  1. Add a NuGet script to your project.

  2. Build. The output files will be created.

License

MIT © Wckd Rzr

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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
0.4.0 139 6/14/2022
0.3.0 220 6/14/2022
0.2.0 149 6/13/2022
0.1.25 124 6/13/2022
0.1.24 131 6/13/2022
0.1.23 120 6/13/2022
0.1.22 127 6/13/2022
0.1.21 130 6/13/2022
0.1.20 134 6/13/2022
0.1.19 129 6/13/2022
0.1.18 126 6/13/2022
0.1.17 125 6/13/2022
0.1.16 131 6/10/2022
0.1.15 136 6/10/2022
0.1.14 132 6/10/2022
0.1.13 93 6/9/2022
0.1.12 89 6/9/2022
0.1.11 96 6/9/2022
0.1.10 92 6/9/2022
0.1.9 103 6/8/2022
0.1.8 103 6/8/2022
0.1.7 104 6/8/2022
0.1.6 100 6/8/2022
0.1.5 101 6/8/2022
0.1.4 95 6/7/2022
0.1.3 94 6/7/2022
0.1.2 99 6/7/2022
0.1.1 101 6/7/2022
0.1.0 101 6/7/2022