views:

40

answers:

3

I want to consume a series of REST services from a provider. But there are a lot of functions I can call and send to the server, so I think it would be a good idea to create a separate library that my C#/MVC2 project can reference and call.

In VS2010, what is the correct project I should select to create this new library? Just plain old "Class library?" It's grouped under "Windows" so I don't know if the correct template to use for a web project.

Thanks.

A: 

"Class Library" would be fine. The Class library template is not tied to anyone particular type of project, so they can be used for Web, Console, Windows, Wpf etc.

Of course the functionality you provide in the Class library might be limited to a specific execution evironment because of the functionality you might put into the library, for example if you develop a bunch of functions that expect to be run in an ASP.NET environment then the functionality of the class library might not be applicable to a Console application.

Chris Taylor
I think I'll be OK. I'm using the WCF REST Preview kit. From the various tutorials I've seen around the web, it looks like the kit can work in both Web and console environments. And I plan to only use the lib in a web environment. Thanks for the answer, though.
Jason
A: 

Technically, yes, a "Class library" will give you what you want. Consider, however, whether there are any potential benefits for you in creating a proxy Web Service that you use as an intermediary between your own application(s) and the remote provider. Doing so allows additional management options that can be performed separately from the calling application.

Alex
Thanks, Alex, but it's going to run on a shared Windows web hosting. Since I'm new to .NET/Windows development, I was unsure if my web host would allow me to run an additional web proxy service.
Jason
A: 

You could also try the MSDN REST Starter Kit. It contains VS templates that help you do all the RESTful things you could ever imagine doing.

hydrogen
Thanks, I tried, but the projects don't work under VS2010 Express, even after a conversion from VS2008 to 2010.
Jason
Ah fair enough, I wonder if it has something to do with the express edition.
hydrogen
It probably does. I'm finding that I can't use the "Paste XML as Type" feature (it doesn't show up in the edit menu).
Jason