简体   繁体   中英

How to use FirstOrDefault for two primary keys

有两个主键a和b一个键可以编译两个键怎么样

var product = db.TMP_HELLO.FirstOrDefault<TMP_HELLO>(instrmnt => (instrmnt.a == good.a; instrmnt.b == good.b));

Use the && operator in your lambda.

var product = db.TMP_HELLO
        .FirstOrDefault<TMP_HELLO>(
            instrmnt => instrmnt.a == good.a && instrmnt.b == good.b);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM