开发者

CRM LINQ + Creating Dynamic where clause for anonymous types

var crm = new XrmDataContext("Crm");

var properties = from property in crm.awx_propertyawx_properties

orderby property.awx_name

select new {
    awx_name = property.awx_name == null ? "no name" : property.awx_name
      }
                                ;
 properties = properties.Where(a => a.awx_name.StartsWith("Sears Tower"));

I get the error "Cannot determine the attribute name" - what am I doing wrong here? I read in plenty of threads that this is perfectly okay to do. HE开发者_如何学JAVALP!


I too spent quite a while trying to find a way of issuing dynamic where clauses against the CRM system.

I tried similar syntax above and also built a predicate builder. Both did not work.

In the end I had to take a 2 stage approach. 1. Pull a superset from CRM using static where clause into a collection 2. Query dynamically from my in memory collection using standard techniques.

I hate CRM.

Phil

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜