1

I could not find any resources online with examples of using LINQKIT with WCF data services. Is it possible ? I tried to do that, but it fails in ExpressionVisitor class in method Visit with error - unhandled expression type 10000.

throw new Exception (string.Format ("Unhandled expression type: '{0}'", exp.NodeType));

Is there any alternative to this.

Example of expression is as given below. It build successfully but gives above error at run time.

            DataServiceQuery<ClassName> query = (DataServiceQuery<ClassName>)
            (from c in data.<ClassName>.AsExpandable()
            where c.<ChildClass>.Any(SamplePredicate.Compile())
            select c);
user3587767
  • 152
  • 8

1 Answers1

1

Yes it is possible:

try
        {
            PoseidonReadEntities poseidonReadEntities = new PoseidonReadEntities(GetServiceUri());

            var predicate = PredicateBuilder.New<vw_PDS_Grants>(true);


            predicate = predicate.And(g => g.Trust == trShortCode);

            if (searchTGN.HasValue)
            {
                predicate = predicate.And(g => g.TrustGrantNo == (int)searchTGN);

            }

            DataServiceQuery<vw_PDS_Grants> dsGrantQuery = poseidonReadEntities.vw_PDS_Grants;

            DataServiceQuery<vw_PDS_Grants> gq = (DataServiceQuery<vw_PDS_Grants>)dsGrantQuery.Where(predicate).OrderByDescending(g => g.GrantID).Take((int)rowsToReturn);

            var grants = await Task.Factory.FromAsync(gq.BeginExecute(null, null), asyncResult => gq.EndExecute(asyncResult));

            DS_vw_PDS_Grants = grants.ToList();

            return DS_vw_PDS_Grants;
        }
        catch (DataServiceQueryException Ex)
        {
            string error = Ex.Message;
        }

        return null;
DNM
  • 11
  • 1