是否可以将 CRM 2011 View (savedquery) 与 linq 一起使用?我的意思是我可以做这样的事情:
IEnumerable<Opportunity> GetOpportunites(CrmOrganizationServiceContext context, string viewName, Guid customerId)
{
var view = context.CreateQuery<SavedQuery>().FirstOrDefault(q => q.Name == viewName);
if(view!=null)
return from Opportunity op in view
where op.CustomerId.Id == customerId
select op;
return new List<Opportunity>();
}