查询条件TPH inheritance 查询的 3 种写法
废话就不多说了,开始。。。
TPHinheritance 查询的 3 种写法
var USACustomers1 = from c inNWEntities.BaseCustomers
where c is USACustomer
select c;
var USACustomers2 = from c inNWEntities.BaseCustomers.OfType<USACustomer>()
select c;
var USACustomers3 = from c inNWEntities.BaseCustomers
select c as USACustomer;
Console.WriteLine("Total number of USAcustomers (is): {0}", USACustomers1.Count());
Console.WriteLine("Total number of USAcustomers (ofType): {0}", USACustomers2.Count());
Console.WriteLine("Total number of USAcustomers (as): {0}", USACustomers3.Count(i => i != null));
第三种写法必须加上I <> null 的条件。
文章结束给大家分享下程序员的一些笑话语录:
祝大家在以后的日子里. 男生象Oracle般健壮; 女生象win7般漂亮; 桃花运象IE中毒般频繁; 钱包如Gmail容量般壮大, 升职速度赶上微软打补丁 , 追女朋友像木马一样猖獗, 生活像重装电脑后一样幸福, 写程序敲代码和聊天一样有**。