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

XObjectsCore references CodeDom #24

Closed
jods4 opened this issue Feb 3, 2021 · 4 comments · Fixed by #27
Closed

XObjectsCore references CodeDom #24

jods4 opened this issue Feb 3, 2021 · 4 comments · Fixed by #27
Labels
enhancement New feature or request

Comments

@jods4
Copy link
Contributor

jods4 commented Feb 3, 2021

XObjectsCore is a runtime requirement for the code generated by this project.

It feels wrong that it references System.CodeDom, which would be better not embedded into our applications.

Do you think it would be hard to correct the layering and have a CodeDom dependency for the code generation only?

@mamift
Copy link
Owner

mamift commented Feb 3, 2021

Hello, yes I'm aware of this and did try separating out the C# code that only does code generation to it's own library in an attempt to bring down the .NET Standard version for the output code, but was never able to finish.

I can't specifically recall the reasons why, but I think a few interfaces were shared between the code that handled typed XML traversal and code that does code generation, and a proper & clean split that would've meant 3 libraries instead of just 2.

I thought at the time that was unnecessary, but I'm not philosophically opposed to it if that's what it takes to separate out the code.

@jods4
Copy link
Contributor Author

jods4 commented Feb 4, 2021

I'm interested in at least giving it a shot, if it doesn't get ridiculously messy.

Is there any list or way to know what classes / public API the generated code actually needs? Or at least some roots and I'll work transitively from that?

Figuring out from the code generator what API might be used in every situation is kind of hard. :(

@jods4
Copy link
Contributor Author

jods4 commented Feb 4, 2021

I had a glance at the project structure.

So currently we have:
LinqToXsd, references XObjectsCore
XObjectsCore, references XObjectsCode
XObjectsTests references LinqToXsd + XObjectsCore

Looks like the shared code in XObjectsCode is not really shared as only XObjectsCore reference it.

I would try to:

  • Keep in XObjectsCore what's required by the runtime only, no references to other projects and no reference to CodeDom.
  • Either merge all the rest directly into LinqToXsd, or turn XObjectsCore into a real lib that could be published on Nuget and is referenced by the CLI project LinqToXsd.

I would not remove any public API, nor rename them nor the namespaces. Just try to move stuff around and do the minimal changes required to cut the dependency on CodeDom from XObjectsCore.

@mamift mamift added the enhancement New feature or request label Feb 5, 2021
@jods4
Copy link
Contributor Author

jods4 commented Feb 11, 2021

@mamift Please have a look at #27, removing CodeDom turned out to be not too bad.

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

Successfully merging a pull request may close this issue.

2 participants