Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Namespace collision in generated code #48

Closed
dcastenholz opened this issue Jan 24, 2019 · 4 comments
Closed

Namespace collision in generated code #48

dcastenholz opened this issue Jan 24, 2019 · 4 comments
Labels
released Issue is resolved in a current release

Comments

@dcastenholz
Copy link
Contributor

I think that it is common for developers to want to name an entity with the same name as part of the project namespace. Ex: I am currently working on a press release application. The project name is PressRelease. My root namespace is PressRelease as well. It is desirable to have an entity named PressRelease, but the generated code will then have numerous errors due to the collision. In my case, ModelClass.FullName for my Stage enum returns "PressRelease.EntityFramework.Model.Stage". In a number of places, this collides with the PressRelease entity name. If ModelClass.FullName could return "global::PressRelease.EntityFramework.Model.Stage" instead, it would avoid the collision.

I was almost able to work around the issue by changing the transform code, but I ran into ModelAttribute.FQPrimitiveType which can return int, bool, string, etc. in addition to my fully qualified class name. In C#, global::int is invalid. Inside FQPrimitiveType is the line: return modelEnum.FullName;, so fixing ModelClass.FullName should work. I realize that there is an argument to be made that says: "Don't do that!", but I believe that this would be a nice feature.

@msawczyn
Copy link
Owner

Thanks for that. I'm looking into it.

@msawczyn msawczyn added the investigating Looking into this label Jan 28, 2019
@msawczyn
Copy link
Owner

The fix you suggest will be in 1.2.7. Thanks for the tip!

@msawczyn msawczyn added enhancement New feature request pending release Issue is resolved in the current codebase, will be published with the next release released Issue is resolved in a current release and removed investigating Looking into this enhancement New feature request pending release Issue is resolved in the current codebase, will be published with the next release labels Apr 16, 2019
@msawczyn
Copy link
Owner

1.2.7 pre-release is in the releases. Could you take a peek and see if this resolves your issue? Thanks!

@msawczyn
Copy link
Owner

Fixed and released in 1.2.7.1. Closing issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
released Issue is resolved in a current release
Projects
None yet
Development

No branches or pull requests

2 participants