Mar 1, 2009 at 4:14 PM
This is a preliminary release,
Let us know what you think...
Mar 17, 2009 at 9:32 AM
I just ran the sample and this looks like it may be pretty cool.

Having a Facebook connection already in place, and having copied the Bin folder into my project, I began the sample code here:


var db = new FacebookDataContext(myCurrentUserApi);//where I replaced the original empty parentheses with a good instance of the facebook.API



I didn't get what the readme.text was saying here:

2. Create an instance of FacebookDataContext using a Facebook.API instance. 
  Example: new FacebookDataContext(myCurrentUserApi);

but now get that it was an abbreviation of the line of code I posted above.

I really am looking forward to banging against this.  The Intellisense is an awesome feature.


Mar 17, 2009 at 9:47 AM
Thanks for the feedback... :-)

If you have any questions don't hesitate to ask, I will release a new version of the library soon.
For more information you can also check out the CodeProject article, and the online example.
Mar 18, 2009 at 5:10 AM
Edited Mar 18, 2009 at 8:29 AM
Hi Dan-el,

I was trying some simple stuff today and was stopped.

Would you expect the following code to work?  It blows up during runtime. 

var db = new FacebookDataContext(myCurrentUserApi);
var orderedUsers = from u in db.user 
                                   select u;
string xxx;  
foreach (var v in orderedUsers)  //  it blows up on orderedUsers here.  I also tried foreach(user u in orderedUsers)  but with the same result.  //Unless I add a useless where to the select-from statement above. 
xxx = v.name;


I was also wondering whether we can select user.name and then do an OrderBy user.last_name without also selecting user.last_name.  In other words, can we order by something that we are not selecting?




Update: okay, since this is an FQL flavor of Link I see I have to have a little understanding of FQL so I know what FQL Linq is about and how it may be different than regular Linq.  I got a little background here:


And from there I get that a Where clause is required.  And I would infer that to do an OrderBy something, that something would have to be in the result set.

Mar 18, 2009 at 9:04 AM
Edited Mar 18, 2009 at 9:08 AM
1. You are correct, you must have a WHERE clause in your Facebook queries. Please read the following explanation (taken from Facebook Developer Wiki):

"In order to make your query indexable, the WHERE in your query should contain an = or IN clausefor one of the columns marked with a * in the Indexable column of thetable. "


I will fix the library to throw the proper exception, thanks for reporting it.

2. Yes, it is possible to sort by a certain column without selecting it.

Mar 18, 2009 at 8:41 PM
Okay, new issue.  Would you expect this to work:


var test1 = from user in db.user 
    where user.uid !=0
    orderby user.last_name
    select user.name;

string somestring = "";

foreach (var v1 in test1)  //blows up on test1 here
    somestring+= v1.ToString();


Mar 18, 2009 at 9:30 PM
No, this query will not work for the same reason:
"In order to make your query indexable, the WHERE in your query should contain an = or IN clausefor one of the columns marked with a * in the Indexable column of thetable. "

In other words, the "not equal" operator cannot be used on the only indexable column in the query.

In any case, there seem to be a bug in the "not equal" operator which I will fix ASAP.

Mar 19, 2009 at 12:48 AM
Edited Mar 19, 2009 at 1:51 AM
Okay, back again.

I ran this fql query up at http://developers.facebook.com/tools.php with a method of fql.query:

SELECT name, pic FROM user WHERE uid=112233446
ORDER BY last_name + ' ' + first_name

Where the uid was my own.  It ran successfully.  Then I translated it into the following in the Linq to FQL:



test1 = from u in db.user
    where u.uid == myCurrentUserApi.uid
    orderby u.last_name + ' ' + u.first_name
    select u.name;

somestring = "";

(string v1 in test1)  //blows up on test1
    somestring += v1.ToString();

But when I use 

orderby u.last_name + " "+ u.first_name

it works.


UPDATE: OK, it actually doesn't work.  It just doesn't blow up.  FQL just ignores an ORDER BY in such cases.  And it appears that you cannot do an order by fieldA, fieldB. 

I will check back here if parsing time or bandwidth become a concern in my Facebook related projects.

Good luck.



Mar 19, 2009 at 8:17 AM
Unfortunatly, string concatanation isn't supported in the LINQ to FQL library yet.