Comments (4)
Hi Lukas,
first of all, thanks for your interest in NMF.
The rationale behind the NMF code generator is that the generated code should be as polished as possible. This is why the types are not generated with using statements. I am aware that this may in some cases cause naming conflicts, but so far, I have almost ignored them.
The NMF code generator is built on top of the CodeDOM model, which means that it generates a model of the code instead of the code itself as a string. The reason for this is the support of multiple .NET languages, though I never really tried anything else than C#. What the NMF code generator does is to store the namespace of a type reference as user data of a CodeDOM type reference. Before the code model is printed, the generator tries to identify name conflits in order to decide whether to generate the fully qualified type or just the type name. However, that feature was never truly tested and rather implemented as a hack, I am not really suprised that you found a bug in there, to be honest.
There are multiple options to proceed here, I would not like to generally generate all type references with the full type name, but one thing that would be sensible to support is to switch to this behavior via a command-line parameter. Alternatively or additionally, one could try to identify the bug in the name clash detection.
Unfortunately, I am currently not able to give you pointers, I will try to provide anytime today in the evening or witin the next days.
Best regards,
Georg
from nmf.
Hi, thanks for the quick response!
I agree that the verbose type names with namespaces should not be the default, but it would be awesome if we could implement a switch or fix the detection mechanism.
I am currently working through the code generation and already understand a bit more. In my specific example, I found that the Reference2Property class creates the property that creates the error, but I can't find where the type of the CodeMemberProperty is set.
from nmf.
I think I managed to fix this. "NMF.Models.Meta" was missing in Meta2ClassesTransformation.DefaultSystemImports, so namespace conflicts with types in that namespace were not detected.
I sent you a pull request with the fix.
Thanks again for your quick help! Without knowing that there is a namespace conflict detection mechanism, it would have taken me a long time to find a fix.
from nmf.
from nmf.
Related Issues (20)
- NMF Expressions - Feature idea - implement `ToLookup` HOT 12
- enum values differ between model and serialization HOT 5
- GC allocations accessing INotifyEnumerable HOT 4
- il2cpp compability for unity3d engine HOT 5
- Ecore2Code does not handle multiple namespaces HOT 5
- MetaRepository can't resolve multiple namespaces with same interface HOT 3
- Code generates incorrectly for models with elements named the same as the class HOT 1
- Generated static Retrieve methods need namespace to qualify ClassInstance reference HOT 5
- Support .NET Standard? HOT 4
- Serialization: Boolean TypeConverter doesn't conform to XML standard HOT 3
- Issue loading model created in EMF HOT 4
- Running Ecore2Code on .NET core HOT 7
- Troubles loading EMF instances of an Ecore model HOT 2
- Using NMF metamodels in Unity HOT 4
- "Data at root level is invalid. Line 1, position 1." HOT 1
- Ecore2Code: Generated reference models have incorrect ModelRepresentationClassAttribute HOT 1
- Support for Extrinsic XMI IDs HOT 12
- API question: how to find all usages of an object? HOT 2
- Some names in .ecore file can cause compilation errors HOT 2
- Problem following tutorial with NMF version 2.0.176 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nmf.