我有实体NhanVienQuanLy继承自实体NhanVien。
var context = new Model1Container();
var result = context.NhanViens;
var resultNV = context.NhanVienQuanLys // not exist
如何获取实体集NhanVienQuanLy的数据?
答案 0 :(得分:2)
你应该可以这样做:
var resultNV = context.NhanViens.OfType<NhanVienQuanLy>();
或在查询语法中查询时:
from n in context.NhanViens where n is NhanVienQuanLy select n;