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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With