-
Notifications
You must be signed in to change notification settings - Fork 49
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
Generate models in more than one namespace #219
Comments
Can we elaborate here on the use cases, but what would it do exactly? Would it be something like...
And then... how would the decision to put a model in this or that namespace be made? For base classes the plan is to be able to fine-tune base-classes per content type alias. Would the same idea work here? |
From how I see my use case developing, I'd like to be able to generate models into different namespaces like I guess I could always create view models derived from the generated models, but that doesn't feel right since the generated models are essentially view models, so should be extending with partials (which is the intent behind generated models being partials, right?) I'm not across the inner workings of how MB discovers and manages partials, but would it be possible that the process applied the same namespace to the generated model as it finds on the partial, and defaults to the namespace from config when no partial exists? Would be good to avoid explicit configuration (ie a stack of partials existing purely to namespace generated models). |
I guess it would be quite a lot of work to not have models in the same namespace, when that is just a built in #C thing. |
So, two things here: (1) models in different namespaces and (2) models in different folders Both are quite interesting features, even though I need to think about the details ;-) Models in different folders... would be problematic for the Visual Studio Extensions, which at the moment generates models as "nested files" under a placeholder file - but that could be changed to simply generate models in a folder. Might even be cleaner. I guess the key thing here is, how do we determine the namespace / folder for a model. I totally like the idea of detecting existing partials. Well, we already do detect them, so just picking the namespace and file location from them would be easy. Of course... you could have 2 partials with the same name in 2 different namespace, and we'd need some help to figure things out... but it probably can be done. But as you write, we want to avoid explicit configuration of everything - which means we want rules in order to figure out what should go where. Can you envision a non-too-crazy rules set which would allow us to determine a folder / namespace for a content type? Based upon the alias... a container folder... something? |
Based on container folder name would actually be pretty nice, wouldn't mind that at all looking at how I structure my doc types now. Personally, I don't mind having all models in the same namespace, that is a nonissue for me. |
See this discussion on Our
Creating this issue to discuss what that means exactly.
The text was updated successfully, but these errors were encountered: