reflection question

  • Thread starter YankeeImperialistDog
  • Start date
Y

YankeeImperialistDog

I've seprated out my layers into seprate solutions (yes i know there will be
celebrations round the world because of this ;-) ). Because my Data Access is
in one dll and my Business Objects are in another dll i need to use
reflection in the for if i need to find properties for unknown classes.
Example: i may have many versions of a business object all of which are "is
a" of the base object, but a few have unique properties. If I want to call
the Fill Method with a string representation of the concrete class to
dynamicly load properties I need to load the dll of the business object.

Questions:
1. Will dot.net cache this so that it can be loaded once and used multiple
times during multiple load calls?
2. is there an alternative that does not require loading the dll w/o
duplicating the code for the object?

Thanks
KES
 
M

Morten Wennevik [C# MVP]

YankeeImperialistDog said:
I've seprated out my layers into seprate solutions (yes i know there will be
celebrations round the world because of this ;-) ). Because my Data Access is
in one dll and my Business Objects are in another dll i need to use
reflection in the for if i need to find properties for unknown classes.
Example: i may have many versions of a business object all of which are "is
a" of the base object, but a few have unique properties. If I want to call
the Fill Method with a string representation of the concrete class to
dynamicly load properties I need to load the dll of the business object.

Questions:
1. Will dot.net cache this so that it can be loaded once and used multiple
times during multiple load calls?
2. is there an alternative that does not require loading the dll w/o
duplicating the code for the object?

Thanks
KES

Hi KES,

Once you load an assembly it will remain loaded until the assembly domain is
shut down (which means the application shutdown unless you use subdomains).
I'm not sure why you need to use reflection though. Can't you just add the
namespace and use the objects directly? That is, why don't you just
reference the assembly in your project instead of loading it manually?
 
P

Paul

Lookup.

Factory, Strategy and Facade patterns.

You should be able to implemet these with your application and forget
reflection. Unless I am mising the point.
 
Y

YankeeImperialistDog

option 3 in your artical was the plan and the question was would i be loading
the assembly each time i make a call to load say 150+ objects that are (bird,
dog, fish) each being a *is a* animal. birds have wings, dogs have paws, fish
have fins. handling the unique properites i can do, not the issue here it's
just getting the correct concrete object.

never use a factory method seems that's the way i should go just got to
learn how, but i think you answered my question.


neverused a factory method before
 
Y

YankeeImperialistDog

bad habit of not fully explaining:
The "quality" of the animal is the issue rules for a good dog and differrent
than a good fish or good bird.
again factory methods????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top