HighTechTalks DotNet Forums  

Creating .Net provider with useful CIM metadata?

Dotnet Framework (WMI) microsoft.public.dotnet.framework.wmi


Discuss Creating .Net provider with useful CIM metadata? in the Dotnet Framework (WMI) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?Q2hyaXMgTA==?=
 
Posts: n/a

Default Creating .Net provider with useful CIM metadata? - 07-31-2007 , 04:44 PM






So as far as I can figure, creating a WMI provider in .Net has serious
limitations in that you cannot add metadata to the properties you're exposing.

By this I mean, for example, I might want a WMI property called "Status"
which is a C# enumerated type (for example: Running, Paused, Down, Error).

Is there any way to expose an enumerated type via the .Net WMI stuff? It
seems like whatever's installing the .Net WMI class could pretty easily
reflect into the property and convert it automatically into a CIM "enumerated
type".

What I have had to do is to create a MOF file that maps to my C# WMI
provider class. In that MOF file I am able to add the missing stuff. For my
example above, in the MOF file I have something like:

[Description("The status property contains status information."),
ValueMap{"0","1","2","3"}: ToInstance ToSubClass,
Values("Running","Paused","Down","Error"}: ToInstance ToSubClass] sint32
Status

Then I have to, after running installutil.exe on the executable, run
mofcomp.exe on the MOF file. Yuck!

Is this really the only way to do an enumeration or to add description
metadata to the WMI properties?

Thanks.

- Chris

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.