Facesharp vs. Facebook C# SDK

Feb 25, 2011 at 8:32 PM

Hi,

There are two primary facebook .net SDKs- Facesharp and Facebook C# SDK.

What are the differences and advantages of Facesharp over Facebook C# SDK for a regular MVC-Based facebook application?

Please don't mention trivial things. I know that Facebook C# SDK works with dynamic objects (and therefore more flexible to the frequent Facebook API's changes)- I'm looking for essential differences such as performance, code efficiency etc.

 

To be fair I also posted this question in the facebook C# SDK's discussions board.

 

Thanks,

Lidan

Coordinator
Feb 25, 2011 at 9:17 PM

Lidan,

Facesharp strives to be able to get you from nothing to fully functional .NET based Facebook development quickly.

Some of the features to note in Facesharp:

  • Lightweight Discoverable API giving you access to frequently used objects and flexibility to use more dynamic results (using Newtonsoft JSON) when you want to move beyond the built-in objects.
    • Ex: can either use
      • facebook.api.User.GetCurrentUser()
      • var jObject = MakeGraphRequest("me", fields: new[] { "id", "name", "first_name", "last_name", "email", "birthday" });
    • Plenty of examples built-in
  • Extensive Client Side Development Support - this is actually quite important in building great Facebook solutions
    • HTML5 Boillerplate (review FacebookApp.Master)
    • Javascript based global event for when Facebook API is ready. (see FeedPublish.aspx )
    • Javascript based multifriend selector

Honestly we haven't done a through review of all the differences we'll be sure to highight the benefits of Facesharp moving forward.

Are there any specific needs you are looking to satisfy?

 


Feb 27, 2011 at 11:15 PM
Edited Feb 27, 2011 at 11:49 PM

Great, Thanks!


1. What about moving to MVC3 and Razor syntax?
2. Is there any reason that "Code" folder is located under FaceSharp.MVC? why did you choose that solution rather than moving the relevant code into the FaceSharp class library?

 

Coordinator
Feb 28, 2011 at 6:08 PM

Lidan,

Just a couple more notes:

Facesharp Relies on a couple of projects (Hammock and JSON.NET) both are very focused on what they do and do it quite well, we don't see a need to reinvent the wheel.

Dynamic Support
JSON.NET has recently added support for dynamics so we will likely expose that through the libarary as well. 

MVC3 / Razor
Aboslutely, we are currently focused on the sample app and will be upgrading very soon (within the current week).

Code Folder
We wanted to keep the core library lightweight, so that you can use with the sample app or not.. so we didn't want to clutter it up with code you might not use.

Performance
I am working with my employer to see if I can showcase some of the sites that we've built using FaceSharp as well as the stats to help give insights into the performance.

-Patrick.

Coordinator
Feb 28, 2011 at 10:42 PM

Lidan,

After upgrading JSON.NET it is now very easy to take advantage of dynamics in FaceSharp:

Example:

        public ActionResult DynamicExample()
        {
            var facebookApi = new FacebookApi();
            dynamic friends = facebookApi.GraphApi.MakeGraphRequest("me", "friends", new[] {"id", "name", "first_name", "last_name"});
            return View(friends);
        }

And in the view:

    <h2>DynamicExample</h2>

    <% foreach (dynamic facebookFriend in ((dynamic)Model).data){%>
           <% = facebookFriend.name %><br />
    <%} %>

Feb 28, 2011 at 11:10 PM

Perfect! So we can now enjoy the best of both worlds :)

Thank you!

Coordinator
Mar 3, 2011 at 4:36 PM

Lidan,

We've just added support for MVC3 / Razor (just upgraded references). 

Expect that future examples will likely transition to Razor.

Please let me know if there is anything else I might be able to help you with.

-Patrick.