views:

160

answers:

1

Hey everyone,

I am working on an ASP.NET MVC project and I am trying to get it integrated with facebook by using facebook connect API. Now, I am having a small problem in imagining how the conceptual layout would be. I am using the repository model in MVC, I have my own DB. I want to be able to fetch user’s information from FB, and maybe store their fb_uid in my database (is that legal anyway?) I also want to be able to post stories into user’s mini feed. I have a model class called User; this class has to be filled with data from both my internal DB, and FB database. I have repository classes to communicate with the database, and I don’t really know where/which part should communicate with FB? I thought of using the FBDeveloperToolkit, but from what I have read in this forum, the toolkit is a bit out of date! I don’t know if I should use XFBML and pure javascript functions? And if yes, how can pull the data back to my DB, for example user’s fb_uid? And does that mean I will be directly calling the API functions from my presentation layer?

Can anyone please help me in this?

Thanks!

+2  A: 

I would suggest a FacebookService layer that implements a subset of functionality you need from the Facebook API. In the DDD world it's called an Anti-Corruption Layer.

Todd Smith
How about building another repository class that communicates with FB, and a single "User Service" consumes both repositories (UserDBrepository, and UserFBRepository)?
OneDeveloper
@OneDeveloper a single "user service" that depeneds on both UserDBRepository and your Facebook data sounds like a good approach. But whether that should be a FacebookRepository or FacebookService depends on the kind of methods you need to support from Facebook. If it's simple CRUD methods then a repository sounds appropriate.
Todd Smith