request: support for nested types
Posted: Wed 21 Dec 2011 18:39
I'm working on a project with a high degree of polymorphism, in which a number of types are nested within another type, forming a type-hierarchy - mostly for semantic reasons, but unfortunately means I have to do a lot of refactoring and cleanup to migrate this project to ED.
It would be useful to have support for nested types.
In terms of UI, I would recommend simply allowing the use of "." in class-names. (alternatively, you could add a ParentClassName property to classes, but that would probably complicate code generation, as you would need to check for this property when generating filenames, and when referencing the type from a navigation-property.)
In terms of code-generation, nested types are allowed to reside in separate files, in multiple partial classes - so that should be fairly straight-forward to do. For example, for a nested type Foo.Bar:
In other words, it's just an extra class-declaration surrounding the inner class-declaration when generating a nested type...
(EDIT: not quite true - you would have to look at the parent type to discover if the parent type was defined as abstract, and take that into account.)
It would be useful to have support for nested types.
In terms of UI, I would recommend simply allowing the use of "." in class-names. (alternatively, you could add a ParentClassName property to classes, but that would probably complicate code generation, as you would need to check for this property when generating filenames, and when referencing the type from a navigation-property.)
In terms of code-generation, nested types are allowed to reside in separate files, in multiple partial classes - so that should be fairly straight-forward to do. For example, for a nested type Foo.Bar:
Code: Select all
public partial class Foo
{
public partial class Bar
{
// ...
}
}
(EDIT: not quite true - you would have to look at the parent type to discover if the parent type was defined as abstract, and take that into account.)