c# - What can I use instead of Where clause in Asyn method? -


i have project in c# , entity framework. need convert of methods of repository async. have problem converting method, not sure can use instead of clause.

    public async task<ienumerable<product>> getproductbyyearidasync(int yearid)     {         return await applicationscontext.product.where(product=> product.yearid == yearid);     } 

when use gave me error cannot await iqueryable. when use firstordefaultasync lot know how convert ienumerable.

where not execute query, there nothing "asynchronous" invoking where. need invoke tolistasync executes query asynchronously.

public async task<ienumerable<product>> getproductbyyearidasync(int yearid) {     return await applicationscontext.product         .where(product=> product.yearid == yearid).tolistasync(); } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

python - cx_oracle unable to find Oracle Client -