.net - Entity Framework 6 - how to convert this line to async? -
i wondering how change statement async?
var findbarcode = context.barcodes .where(x => x.code == barcode) .select(x => x.product).firstordefault();
i don't see async where
statement can use.
what singleasync or findasync? not sure firstordefault one
do use await.
var findbarcode = await context.barcodes .where(x => x.code == barcode) .singleasync(x => x.product);
another way (might silly have no access vs @ present):
var findbarcode = await context.barcodes .where(x => x.code == barcode) .orderby(yourcriteria) .take(1) .select(x => x.product) .tolistasync();
Comments
Post a Comment