TypeScriptBuilder icon indicating copy to clipboard operation
TypeScriptBuilder copied to clipboard

Feature: Override namespace

Open enkelmedia opened this issue 5 years ago • 0 comments

The TS-namespace is based on the namespace of the C#-class which is probably a great default but it would be useful to be able to override the namespace for a class.

In my case I tend to organize all my C#-objects in "feature folders" but I'm not sure that I need the same structure for the namespaces in the front end project.

I guess this could be fixed with some kind of attribute on the class? It would also be nice to have some "global" override that would use the same namespace for all TypeScript-classes. Something like:

var ts = new TypeScriptGenerator();
ts.AddCSType(typeof(MyApp.Feature.Models.CustomerDto));
ts.SetNamespace("MyApp.Models");
var data = ts.ToString();

Same here, let me know if you would be interested in a PR.

enkelmedia avatar Jan 08 '21 07:01 enkelmedia