views:

89

answers:

2

When using reflection we typically just was the basic System.Reflection API but I am wondering if anyone know of a nice "wrapper" layer or API that has a more "schema style" approach? (e.g. kind of like a code generators DB schema view)

This is for use in code generators, like T4 templates etc...

A: 

Are you just looking at generating schemas for existing DLLs?

.NET Reflector might help you with what you need. There are heaps of plugins for different visualization aids, I haven't tried them all...

David Hedlund
Sorry David - I should have given more context. I am thinking from a code generation point of view...
Paul Kohler
A: 

See Type Descriptor Overview. Most people use it for designtime awesomeness since it allows you to create new/hide existing properties, or totally modify how a control is represented in Visual Studio's property box. However, it works just as well in runtime as designtime. For example, calling TypeDescriptor.GetProperties will get you all the properties of a type or object (instance-specific properties) from whatever TypeDescriptorProvider that is registered for that type/object. You can chain them, and there's a default provider that uses the old reflection technology if nothing more specific is registered.

This basically means that calling GetProperties on your plugin would allow that plugin to show more settings that it really has, and allow it to persist those in any way it wants, which brings in some awesome scenarios for custom property boxes or reflection visualizers.

Simon Svensson
Nice idea, I'll give that a try :-)
Paul Kohler