Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?)

What I have tried:

Asked my neighbour's pet dog - his reply was not intellectually convincing.
Need end-user technologists opinions :-)
Posted
Updated 5-Jul-16 23:09pm

1 solution

If its a UI type application where doing this 'on-demand' may impact the user perception, I would go the 'startup' route - but if it's a service type application, I see no reason why 'on first use' wouldnt be good enough

(you havnt given us a lot to go on, so maybe your neighbour's pet dog might have been a better bet - one woof for 'startup', two woofs for 'on demand', and 'whatever' if he bites you) :-)
 
Share this answer
 
v2
Comments
Duncan Edwards Jones 6-Jul-16 5:16am    
So - looks like "both configurable" then.
Garth J Lancaster 6-Jul-16 6:42am    
woof woof woof :-)

seriously .. I built a component recently that I'll be 'improving' for a bit .. I was looking for a pattern to describe 'query service a, if that fails, query service b, ....', as a 'failover' pattern/?concept ... what I really wanted to do was have a service and pass a delegate to it to another service if the 1st service failed, etc etc ... it strikes me (wether or not Im making sense/using the correct terms) that your situation is a little the same .. ie, try and instantiate the mappings you can at startup, but be prepared to check them at first use

probably a rotten idea

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900