Runtime class mapping - at startup or on demand?
I have the need to map a number of different classes in my application to specific instances of a class that is in charge of persisting them to/from the back end.
This is conceptually similar to the way Entity Framework creates it's mappings with the DbModelBuilder class.
Should I map all the classes at application startup? (They are identifiable by an interface and an attribute tag) or should the mapping occur when a particular class is first used?
(or both, configurable?)
Re: Runtime class mapping - at startup or on demand?
I'm not quite sure what you mean by "map" in this instance.
Re: Runtime class mapping - at startup or on demand?
Given a configuration file like this:-
Code:
<ImplementationMaps>
<Map AggregateDomainQualifiedName="HospitalWard.Nurse" ImplementationName="InMemoryImplementationExample" SnapshotSettingsName="InMemorySnapshotExample" />
</ImplementationMaps>
I want to map the class "HospitalWard.Nurse" to be stored in an In-memory data storage called "InMemoryImplementationExample".
The idea is that I can change the mapping between different storage technologies (file, database, memory) without recompiling my application.
(It's a bit like routing is configurable in a web app)