Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们首先使用 EF 代码创建了一个 azure sql DB。假设我们有 3 个实体/表学生、班级、教师。我们想实现一个像这样的方法:T GetEntity(ket int),它通过键从一个根据 T 的表中获取一个实体。这可能吗?德克萨斯塔尔
您正在寻找Find方法。
Find
var student = context.Set<Student>().Find(1);