nicoriff / ORMi

A Light-ORM for accesing WMI
MIT License
209 stars 28 forks source link

Can't use async query with Helper #35

Closed madjarian closed 2 years ago

madjarian commented 2 years ago

Hi and thank you for your work. i try to use Ormi with async query like that:

  [WMIClass("Win32_Processor")]
    public class Processor : WMIInstance
    {
        public string Name { get; set; }
        [WMIProperty("NumberOfCores")]
        public int Cores { get; set; }
        public string Description { get; set; }
    }

WMIHelper helper = new WMIHelper("root\\CimV2", host, account, password);
List<Processor> processors = await helper.QueryAsync<Processor>().ToList();
...

but i got Compiler Error CS1061 with msg like: Task<IEnumerable> no definition for ToList()... is anybody have a idea to fix that ?

nicoriff commented 2 years ago

Try:

List<Processor> processors = (await helper.QueryAsync<Processor>()).ToList();