How to use dynamic linq in wcf?

advertisements

I am using linq-to-entity to retrieve data dynamically and created a method as follows:

public List<object> getDynamicList(string tablename, List<string> colnames)
{
    try
    {
        var query = DynamicQueryable.getDynamicData(dbcontext, tablename, colnames);
        List<object> objQueryable = new List<object>();
        object obj = query.AsQueryable();
        objQueryable.Add(obj);
        return objQueryable;
    }
    catch (Exception ex)
    {
        HandleError(ex);
    }
}

this method in wcf service internally refers dynamic class given in LINQ samples (C:\Program Files (x86)\Microsoft Visual Studio 10.0\Samples\1033)by MSVS2010.

when i am passing tablename,columns dynamically it does but on client side,while consuming that method it gives error- The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error. does wcf gives issue with iqueryable return type ?

please suggest......


You should look into WCF Data Services aka oData Services