Saturday, January 15, 2011

Writing a MMC Plugin, with MVP and Unity

Damian SchenkelmanMMC 3.0 Sample Plug-In using MVP and Unity

“The last couple of days I have been working on a MMC spike that leverage dependency injection and some kind of presentation pattern (in this case MVP), to search for ways to make MMC applications more testable. The scenario I chose for the spike was having a plug-in that could connect/disconnect network adapters through a service that used WMI objects. The sample is very fresh, and there is still work to do to decouple things a bit more (for example, moving strings for WMI objects to config files).

To work with MMC, you need the Microsoft.ManagementConsole.dll assembly, which comes as part of the Windows SDK 6.1 for Windows Server 2008. This is important because versions 7.0 and 7.1 do not include this assembly. Additionally,  “MMC is one of the very few extensibility point in the OS that will not support .NET 4. MMC ” (from this thread), which is why MEF went out the door and in came Unity.


This is one of the edge case dev projects that many of us don’t usually encounter, the writing of an MMC Plugin. Given that I really like Damian’s approach the building of this MMC Plugin sample. MVP & Unity is just not something I’d really have thought of, though I should have, when building one…

No comments: