Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Runtime class mapping - at startup or on demand?

Merrion

PowerPoster
Joined
Jul 26, 2002
Messages
2,148
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?)
 

Merrion

PowerPoster
Joined
Jul 26, 2002
Messages
2,148
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)
 
Top