开发者

C#: Correct project template for REST API library?

I want to consume a series of REST services from a provider. But there are开发者_JAVA百科 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.


"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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜