I am designing the classes so that each class uses the data access layer to populate itself from the database. All classes would be instantiated empty and would load themselves based on a given Id. The Business Layer Session would simply loop through all classes in the session and call load() on each.
What is the best way to instantiate all 297 classes and have them empty and waiting in the Session? I was looking at IoC, Reflection, and the good ole object factory switch statement but that switch is too massive. I really don't want to hard code the class names to be registered and created within the code...regardless of IoC, reflection, or delegate method registration.
I was kind of thinking of adding an extended property to each table (DomainObject: TypeStringOfObject) since the Domain Classes match one to one against the tables. Then just grab all of those extended property values from any tables that have them. My code would create instances of classes based on the extended properties that are returned. That seems overkill to me. The other thing I was thinking about was creating a class instance for every class in that specific namespace but I think using reflection would be a huge performance hit. I guess an IoC container would be my best option for the second approach.
Any ideas on how to deal with my scenario without having a large switch statement in a factory? Or having to read in the list of 297 classes that need to be created?
Thanks -Ken