views:

51

answers:

1

I currently am developing in VS 2008 with no access to vs 2010.

I would like to use http://facebooksdk.codeplex.com/ but there is no way to use dynamic in vs 2008 so I don't think this is an option.

Options are

http://github.com/facebook/csharp-sdk

http://facebooktoolkit.codeplex.com/

http://facebooknet.codeplex.com/

I'm looking to implement facebook connect, to allow users to create accounts on my asp.net website very quickly.

What are the advantages / disadvantages of these?

+2  A: 

You in fact can use the Facebook C# SDK (http://facebooksdk.codeplex.com) with .Net 35. We actually don't rely on the dynamic keyword internally in the library so we are able to compile it to .net 4.0 and .net 3.5. If you download the latest release you will find builds for .Net 4.0, .Net 4.0 Client Profile, .Net 3.5, .Net 3.5 Client Profile, Silverlight 4, and Windows Phone 7.

While most of the examples on the site show how to use dynamic, you actually can use the objects without the dyanmic keyword. For example:

var app = new FacebookApp();
var result = (IDictionary<string, object>)app.Api("me");
string firstName = (string)result["first_name"];
string lastName = (string)result["last_name"];

The dynamic keyword makes it a bit easier to access the dictionary objects, but it is not required. Let me know if you have any other questions. @ntotten

FYI, I am the creator of the Facebook C# SDK at facebooksdk.codeplex.com.

Additionally, the old Facebook Toolkit has not been updated in many months and is starting to run into trouble with the new facebook authentication systems and apis.

Nikhil's Facebook.Net (facebooknet.codeplex.com) project has not been updated in over 2 years and is definitely NOT compatible with the Graph API or the new OAuth authentication.

Lastly, the 'official' Facebook C# SDK from Facebook is very simple and really only does a few basic things such as make a api call. There is nothing in there for authentication, etc.

Nathan Totten
That's really good Nathan, I was confused about this myself
MikeAinOz
Excellent answer, and interesting that it can work without the dynamic keyword. I was almost going to upgrade everything, but this may work. I've actually temporarily gone with the Facebook Toolkit, but if I have problems I assume it won't take me long to switch over. Ran into odd problems when I realised I was referencing an old very version of the javascript sdk, as I followed an old tutorial. Remember latest js sdk method calls requires and up to date sdk import link.
optician
Ah, I just found that after switching to the lastest version of the JS SDK, my app no longer can access the API? Is this because they have changed from the xdreciever call back method? I no longer see this referenced in the init function call? I assume that your API does not need this and will work with the latest fb.init style
optician
Can you be more specific about how to know what return types are passed back from the API calls, or is it a case of manually working out what type of type would fit? Or would you always use the IDictionary as shown above?
optician
The old Facebook Toolkit will have a lot of problems with the new Javascript SDK. I don't really want to get into this, but you can browse their forums for work arounds. My Facebook C# SDK works ONLY with the new Javascript SDK.
Nathan Totten
Regarding the return types everything is "dynamic". So you either use the dynamic keywork or use a dictionary. We aren't using strongly typed values in the SDK besically because it would be a mess and Facebook changes everything too much. You can read my blob post about that here: http://ntotten.com/2010/09/dynamic-objects-and-the-facebook-c-sdk/.
Nathan Totten
To figure out what values are returned from an API call using the C# sdk you simply have to refer to Facebook's documentation. We return everything exactly as facebook provides it. This way, our SDK is always up to date. If facebook adds a new call, a new field, etc. you dont have to wait for us to rebuild the library, you can just use the new feature.
Nathan Totten
Also, don't forget to mark this as 'the answer'. :)
Nathan Totten