public static IEnumerable <IWbemClassObject_DoNotMarshal> Get(string nameSpace, string strQuery) { strQuery = Regex.Replace(strQuery, "Win32", "UNIX", RegexOptions.IgnoreCase); strQuery = Regex.Replace(strQuery, "unix_", "UNIX_", RegexOptions.IgnoreCase); var tableName = GetClassNameFromQuery(strQuery); var doc = Document; if (doc != null) { XmlNode node = doc.SelectSingleNode(string.Format("//*/Namespace[@Name='{0}']/Class[@Name='{1}']", nameSpace, tableName)); if (node != null) { /* Look for static object MOF reference */ /* This is a dynamic object */ Type type = Type.GetType(node.Attributes["Type"].Value, false, true); if (type != null) { if (!type.IsClass) { throw new InvalidDataException("Invalid class"); } else if (type.IsAbstract) { //Find First Declarative Type in Derivation of {type} var fallbackNamespaceNode = node.Attributes["FallbackNamespace"]; var fallbackClassNode = node.Attributes["FallbackClass"]; if (fallbackClassNode != null) { string fallbackNamespace = nameSpace; if (fallbackNamespaceNode != null) { fallbackNamespace = fallbackNamespaceNode.Value; if (fallbackNamespace.Equals(nameSpace, StringComparison.OrdinalIgnoreCase) && fallbackNamespaceNode.Value.Equals(tableName, StringComparison.OrdinalIgnoreCase)) { throw new InvalidDataException("Circular Dependency failed on Abstract CMI Class"); } return(Get(nameSpace, fallbackNamespaceNode.Value)); } else { // Launch Declarative Type Discovery throw new InvalidDataException("Invalid class"); } } } else { IUnixWbemClassHandler handler = GetHandler(type); return(handler.Get(strQuery).Select(x => new UnixWbemClassObject((IUnixWbemClassHandler)x))); } } } } return(new IWbemClassObject_DoNotMarshal[0]); }