I am building a set of tools to manage my system. I like the idea of
building PowerShell cmdlets to manage my system and then having a GUI that
puts a front end on the cmdlets. I get scripting and a GUI with one code
base. That is the goal.
My cmdlets output types defined in the cmdlet. Some of the types contain
object graphs of arbitrary depth - they are typical .NET types which might
contain with collections which in turn contain objects with properties some
of which might be collections.
I wanted to minimize the coupling between the GUI and the cmdlet. I can
invoke a pipeline which executes the cmdlets and they return their results
without trouble. The problem is that I cannot access the cmdlet's types in
C# without adding a reference to the cmdlet's assembly. Adding that
reference is a coupling I was trying to avoid. I could use the property bag
to pull the values out of the custom types but that is cumbersome with types
that have object graphs of any depth.
What should I do? Add the reference. Pull the types out of the cmdlet and
into its own assembly and then share that assembly between the GUI and
cmdlet. Use reflection. Write the GUI in IronRuby and access the types
without a reference.
Does anybody know how Microsoft does this with it's exchange management shell?