This is a migrated thread and some comments may be shown as answers.

"server side not implemented"

2 Answers 43 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
XXXX
Top achievements
Rank 1
XXXX asked on 20 Feb 2012, 01:14 PM
The following code give me a "server side not implemented" error at runtime.
public IList<short> VisibleBooks(short userID)
{
  return this.Context.my_roles.Where(r => r.UsersIDs().Contains(userID)).SelectMany<my_role, short>(r => r.VisibleBookIDs()).Distinct<short>().ToList<short>();
}


I'm using OA 2011.3.112 against SQLserver 2008.

I saw an old thread on similar subject where it's stated that it has been fixed but it looks like it doesn't apply to this.

2 Answers, 1 is accepted

Sort by
0
XXXX
Top achievements
Rank 1
answered on 20 Feb 2012, 01:59 PM
Found the cause for the error.
The UsersIDs is a method or extension on the OA role that returns list of user Ids.

The work around I found was to put the "select" into the LINQ and materialize it before the SelectMany.
So it looks something like

public IList<short> VisibleBooks(short userID)
{
 var tmp = this.Context.my_roles.Where(r => r.users.Select(u => u.UserId).Contains(userID)).ToList();
 return tmp.SelectMany<my_role, short>(r => r.VisibleBookIDs()).Distinct<short>().ToList<short>();
}
0
Accepted
Thomas
Telerik team
answered on 20 Feb 2012, 06:38 PM
Hello Björn,

OpenAccess cannot look into methods on the persistent types that are beeing called. This is why using the Users collection worked, whereas using UsersIDs() did not. The same applies to VisibleBookIDs().

Greetings,
Thomas
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
LINQ (LINQ specific questions)
Asked by
XXXX
Top achievements
Rank 1
Answers by
XXXX
Top achievements
Rank 1
Thomas
Telerik team
Share this question
or