Are you asking about the possibility to operate with legacy database having some additional columns in tables (in comparison to mapped ones), or about the possibility to (re)generate Entities (their C# files) for it?
First case is supported in "LegacySkip" upgrade mode, if default value is provided for such columns.
Second case is not supported - at least, currently. Although this feature is in our near-time TODO list.
AOP is helpless here - emitting custom types is actually pretty far from typical problems solved by AOP. Btw, PostSharp injects aspects at compile time.
I don't see any serious reasons to emit the classes at runtime:
-
DO4 isn't much interested in your own types. It relies on its own model, that, being originally built using reflection, can be modified in IDomainModule.OnDefinitionsBuilt event.
-
Most likely, your own code won't be able to deal with user-defined types as well - simply because it doesn't know them at the moment it gets compiled.
But this doesn't mean this can't be done. E.g. you can emit the types, that are descendants of your own types (likely, there must be something common ;) ), using C# CodeDOM, and make DO using them further.
I also recommend you to seriously think, if this is really necessary: such a solution will significantly increase the complexity. Probably, it's enough to implement a typical Entity-Property-Value model implying no changes of schema in runtime. if typical case is adding few user-defined columns, such complex solution seems unreasonable. Also note, that schema is normally a bit more then just columns and tables - e.g. there are indexes.
answered
Aug 02 '10 at 10:30
Alex Yakunin
2971●4●4●12