Mike Eghtebas
asked on
Store meta data from .dbml table in a dictionary variable.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Saige,
I just got back from gym, after 10 hours of work/study today. Here I found lots of gifts from you that will take me some time to digest.
I kindly appreciate the help.
Mike
I just got back from gym, after 10 hours of work/study today. Here I found lots of gifts from you that will take me some time to digest.
I kindly appreciate the help.
Mike
Source
So how does reflection help us?
Simple -
Open in new window
Produces the following output -
But we can make it better by adding in polymorphism and extension methods. What is polymorphism?
Source
More specifically Interface-Based Polymorphism
Using interface-based polymorphism, we can create an interface that will be used to identify *any* class that you want to retrieve the properties of and place them into a dictionary.
Why is this important to us? Because extension methods (like any other method, class, etc.) allow for us to constrain the type that can call it. This is important because maybe we don't want to be able to make all classes into dictionaries, it also allows for us to group the classes that we do wish to get dictionaries for together. So how do we do this, like such -
Open in new window
Produces the following output -
-saige-