简体   繁体   中英

Find entity with unique id without knowing its type EF

Is there any way to find an entity with its unique id without knowing its type ?

For example write

DataContext.Find(Id);

instead of

DataContext.Set<T>().Find(Id);

Thanks

Id is unique only within the table. You can not give Id and ask, in which table is it used...You do not want to do it this way :)

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