Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to prevent the prefix from being added to the output path #300

Open
MrMikeJJ opened this issue Jan 27, 2022 · 2 comments
Open

Option to prevent the prefix from being added to the output path #300

MrMikeJJ opened this issue Jan 27, 2022 · 2 comments

Comments

@MrMikeJJ
Copy link
Contributor

Hi,
It would be nice if there was an option to prevent the Prefix from being added to the output path
thanks
Mike

@MrMikeJJ
Copy link
Contributor Author

MrMikeJJ commented Feb 6, 2022

Hi,

The prefix is only used for autogenerated namespaces, not explicit namespaces.

When i was playing around with this, i seemed to get mixed results.
As in, when ran through the library - yes that is how it works through the GeneratorConfiguration constructor.

However i seem to get different results when ran from the EXE - it always adding it. I believe it is because the command line version goes through CodeUtilities.ParseNamespace which seems to always append the Prefix. (so is this inconsistant behaviour a bug ?)

So, what i was requesting with this feature request, was really how i was expecting it to work:
Added Prefix always added and output into the directory specified.

e.g. for an XSD with namespace "Foobar" - set to separate files
with the output directory - ProgramDirectory\Entities\Xml
and the prefix to be "ProgramName.Entities.Xml"

Expecting files to like
ProgramDirectory\Entities\Xml\Foobar\Foo.cs
ProgramDirectory\Entities\Xml\Foobar\Bar.cs
with namespace "ProgramName.Entities.Xml.Foobar"

Also, while i was testing the behaviour of this running as a library, i wrote about 20 unit test (which test the current behaviour) - with the Prefix being added in a few different ways, 1 file vs Separate files, etc.
Would you like a PR for these Unit Tests ? (they run of a local copy of the sample Xsd from https://docs.microsoft.com/en-us/visualstudio/xml-tools/sample-xsd-file-simple-schema?view=vs-2022

@mganss
Copy link
Owner

mganss commented Feb 7, 2022

Sure. If you're interested, a PR implementing the behavior you have described (optionally create separate folders for every namespace component) would be welcome as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants