Nhu Nguyen
Nhu Nguyen

Reputation: 874

Inherit in Ado.net Entity Framework

enter image description here

I have entity NhanVienQuanLy inherit from entity NhanVien.

 var context = new Model1Container();
 var result = context.NhanViens;
 var resultNV = context.NhanVienQuanLys // not exist

How to get data of entity set NhanVienQuanLy?

Upvotes: 2

Views: 87

Answers (1)

BrokenGlass
BrokenGlass

Reputation: 160992

You should be able to do this:

var resultNV = context.NhanViens.OfType<NhanVienQuanLy>();

or when you query in query syntax:

from n in context.NhanViens where n is NhanVienQuanLy select n;

Upvotes: 2

Related Questions