EntityFramework Get object by ID?

前端 未结 8 748
旧巷少年郎
旧巷少年郎 2020-12-23 20:48

Is it possible with Generics to get an object from my EntityFramework without knowing the type?

I\'m thinking of something along the lines of:

public         


        
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 21:44

    I think the Find() method may be able to do what you're looking for (DbSet.Find Method).

    var someEntity = dbSet.Find(keyValue);
    

提交回复
热议问题