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

Sitecore namespace conflicts #98

Closed
mattbarry opened this issue Aug 24, 2021 · 3 comments
Closed

Sitecore namespace conflicts #98

mattbarry opened this issue Aug 24, 2021 · 3 comments

Comments

@mattbarry
Copy link

Do you want to request a feature or report a bug?
Enhancement

What is the current behavior?
The generated models reference the Sitecore.ContentSearch and Sitecore.Data namespaces directly. I'm in the unfortunate situation of inheriting a Helix-like project that has chosen a namespace of Org.Sitecore.Feature.Module. So when Synthesis references the Sitecore namespace the compiler thinks it is referring to the project namespace and compilation fails. Much of my codebase aliases the Sitecore namespace to something like SC, but I can't do that with the Synthesis-generated code.

What is the expected behavior?

The desired behaviour might reference global::Sitecore.ContentSearch and global::Sitecore.Data, similar to the way the searchFields constructor in concrete model classes references global::System.Collections.Generic.IDictionary. I would be happy to submit a PR if this sounds like a desirable solution.

Please mention your Sitecore version and Synthesis version.
Sitecore 9.3.0 and Synthesis 9.1.2.1

@blipson89
Copy link
Owner

Your best bet for this situation would be to use Leprechaun for code generation, if that's an option.

I am planning another Synthesis release next week. If you'd like to submit a PR to add global::, I think it would be in CodeDomGenerator.cs, but it's been a loooooong time since I've touched that code. If you don't want to submit a PR for it, I can also take a peek this weekend.

Leprechaun's code generator is a LOT more flexible and is designed to work with Synthesis out of the box.

@mattbarry
Copy link
Author

mattbarry commented Aug 24, 2021

Awesome. Thanks @blipson89! I had a look at the Synthesis code last night and it does indeed look like I could just update CodeDomGenerator.cs. I'll try to get a PR submitted this week, but I'll look into Leprechaun as well.

I really appreciate your suggestions!

@blipson89
Copy link
Owner

Released in 9.1.4 - thank you for the help!

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