CRM2011 linq 查询
// *****************************************************************************************************************
// LNQ Retrieving related entity columns (for 1 to N relationships)
// *****************************************************************************************************************
System.Console.WriteLine();
System.Console.WriteLine("List of Contact and Account Info by retrieving related entity columns");
System.Console.WriteLine("======================================");
var query_retrieve1 = from c in context.ContactSet
join a in context.AccountSet on c.ContactId equals a.PrimaryContactId.Id
where c.ContactId != _contactid2
select new { Contact = c, Account = a };
foreach (var c in query_retrieve1)
{
System.Console.WriteLine("Acct: " + c.Account.Name + "\t\t" + "Contact: " + c.Contact.FullName);
}
System.Console.WriteLine("=====================================");
System.Console.WriteLine();
posted on 2011-05-13 17:48 HelloHongfu 阅读(185) 评论(0) 收藏 举报
浙公网安备 33010602011771号