No support for .Skip() or .Where() operators?

Dec 18, 2011 at 2:53 PM
Edited Dec 18, 2011 at 2:57 PM

There are 2 use cases for which I'm currently evaluating SSAS Ef Provider. We have large dimensions and we want to allow the user to browse and search these huge sets of data.

1) We want to support paging - my initial thought (this is how I would do it in Linq to Sql) is to use a combinations of Skip() and Take() operators. But Skip() throws and exception:

SsasEntityFrameworkProvider Error: 2046 : System.NotSupportedException: Skip() and pagination are not supported yet.Consider using cube level calculated set instead.

2) We want to support searching. I'm trying to use StartsWith() which again, throws:

Unhandled Exception: System.NotSupportedException: LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[<>f__AnonymousType1`3[System.String,System.String,System.String]] TakeWhile[<>f__AnonymousType1`3](System.Linq.IQueryable`1[<>f__AnonymousType1`3[System.String,System.String,System.String]], System.Linq.Expressions.Expression`1[System.Func`2[<>f__AnonymousType1`3[System.String,System.String,System.String],System.Boolean]])' method, and this method cannot be translated intoa store expression.

Any suggestions?

Here's the method that I added to the sample provided with the example.

        private void GetAllCustomers()
        {
            var result =
                (
                    from customer in context.Customers
                    select new
                    {
                        customer.CustomerID,
                        customer.ContactName,
                        customer.ContactTitle
                    }
                )
                //.OrderBy(c => c.CustomerID)                       // OK
                //.Skip(8)                                          // Throws
                //.Take(8)                                          // OK
                //.TakeWhile(c => c.CustomerID.StartsWith("B"))     // Throws
                //.Where(c => c.CustomerID.StartsWith("B"))         // Throws
                //.Where(c => c.CustomerID == "THEBI")              // OK
                .ToArray();
 
            //Show result
            string rowFormat = "{0,15}\t{1,40}\t{2,25}";
            Console.WriteLine();
            Console.WriteLine(rowFormat, "CustomerID""Contact Name""Title");
            foreach (var row in result)
            {
                Console.WriteLine(rowFormat, row.CustomerID, row.ContactName, row.ContactTitle);
            }
            Console.WriteLine();
        }

 

Coordinator
Dec 20, 2011 at 3:03 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Dec 20, 2011 at 3:09 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Dec 20, 2011 at 3:44 AM

Yes, it is correct, Where() is supported, but Skip() and StartsWith() are not supported yet. It means that you cannot do paging using pure LINQ, as of ver. 1.3.0.

Both paging/.Skip() and StartsWith() are in our development plan - I have just created 2 corresponding tasks for both features:

Yes, it is correct, Where() is supported, but Skip() and StartsWith() are not supported yet. It means that you cannot do paging using pure LINQ, as of ver. 1.3.0. Both paging/.Skip() and StartsWith() are in our development plan - I have just created 2 corresponding tasks for both features: http://ssasefprovider.codeplex.com/workitem/3 and http://ssasefprovider.codeplex.com/workitem/4

Until we release these features your work around for paging and StartsWith() is to use pure MDX, which can be done using named MDX column to .NET property mapping via our AdomdExtensions library, see http://ssasefprovider.codeplex.com/wikipage?title=AdomdExtensions&referringTitle=Work-arounds for an example. (AdomdExtensions does support MDX names with spaces and hierarchies).

Coordinator
Feb 10, 2012 at 11:10 PM
Edited Feb 10, 2012 at 11:12 PM

Skip(), pagination and string functions Contains(), StartsWith(), IndexOf(), ToLower() and ToUpper() are all supported by now.

TakeWhile() and SkipWhile() are not supported by ADO.Net Entity Framework itself.

See http://ssasefprovider.codeplex.com/discussions/299489 for details.