Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to generate a C# HTTPClient wrapper for a WebAPI project? [closed]

In an upcoming project we are looking to use ASP.NET WebAPI 2 to expose service functionality to both our web sites and browser clients.

Since we want as few "end-points" as possible where possible we want all calls, even "internal" to consume our servers from the WebAPI web services. (i.e. not just new-ing up a controller instance directly)

I am looking for something to help generate or scaffold C# "client's" that wrap the HTTPClient and deliver strongly typed "proxy's". Similar to WCF when generating proxy's via "Add new service reference".

I have read other questions asking similar things (As seen HERE), but wanted to ask a more direct question not related to MVC or testing concerns.

like image 644
BoxOfNotGoodery Avatar asked Oct 21 '13 16:10

BoxOfNotGoodery


People also ask

Does C have a random number generator?

C library function - rand()The C library function int rand(void) returns a pseudo-random number in the range of 0 to RAND_MAX. RAND_MAX is a constant whose default value may vary between implementations but it is granted to be at least 32767.

How do C numbers generate random numbers?

To generate random numbers in C#, use the Next(minValue, MaxValue) method. The parameters are used to set the minimum and maximum values. Next(100,200); We have set the above method under Random() object.


1 Answers

This is the best representation of what I was looking for:

ASP.NET Web API <#= Proxy to T4 #>

Introducing WebApiProxy: Providing JavaScript & C# proxies with Intellisense including documentation for ASP.NET Web API

He put his example code up on github:

https://github.com/RestCode/WebApiProxy

Hope this might come out in an official way later.

like image 62
BoxOfNotGoodery Avatar answered Oct 06 '22 18:10

BoxOfNotGoodery