ORMi is a new .NET library I wrote to communicate to WMI (Windows Management Instrumentation). I´ve made several dozens of WMI compatible apps over these years and I always came to the conclusion that .NET standard libraries are very poor and make developers write too much code to get simple values. That´s where ORMi stands - by making every WMI work much more easily and letting developers write more readable, easy to understand, and maintainable code.
I've added several improvements since the first versions of ORMi, such as - async methods, WMI watcher, and WMI method support.
Anyone who has worked with WMI and .NET can tell you that WMI work can be a headache. WMI class names are not the simpler ones and definitely not more intuitive. They have tricky and non conventional names. I bet you would never want to give that name to a class on your project. That's one thing that makes ORMi simpler and more intuitive.
Let me show you how it works.
To get the full experience with ORMi, it is important to have our model defined and mapped to a WMI Class. Let's suppose that we want to get a list of devices connected to the PC. That is quite simple.
- [WMIClass("Win32_PnPEntity")]
- public class Device
- {
- public string Name { get; set; }
- public string Description { get; set; }
- [WMIProperty("Status")]
- public string StatusName { get; set; }
- }
The above class is enhanced with the use of some attributes. WMIClass tells ORMi the name of the WMIClass that Device represents. WMIProperty attribute tells which is the WMI property that will be mapped to that property. ORMi works like this: If there is no attribute, then the member name is used to do the mapping. If an attribute has been set, then the attribute name is used.
Then, with our model properly set, we can query WMI to get the instances we want.
Join the conversation! Your thoughts help the community grow.