C# Class Flatwhite.WebApi.WebApiPhoenix

A web api phoenix to support auto refresh for webApi

It will create instance of WebApi controller and invoke the ActionMethod with cached arguments. It will not work if the controller required QueryString, Headers or anything outside these action method parameters But you can override the Phoenix MethodInfo, Arguments or method Phoenix.GetTargetInstance, Phoenix.InvokeAndGetBareResult, or completely change the way the Phoenix reborn by overriding method , Phoenix.Reborn, Idealy, keep Controller thin and use proper Model binding instead of dodgy access the Request object.

Inheritance: Flatwhite.Hot.Phoenix
显示文件 Open project: vanthoainguyen/Flatwhite Class Usage Examples

Public Methods

Method Description
WebApiPhoenix ( _IInvocation invocation, WebApiCacheItem cacheItem, HttpRequestMessage originalRequestMessage ) : System

Initializes a WebApiPhoenix

Protected Methods

Method Description
FireAsync ( ) : Task

Send a http request with special header to loop back address to by pass the cache

GetTargetInstance ( ICacheDependencyScope scope ) : object

Not support in WebAPI

Private Methods

Method Description
CloneRequestMessage ( HttpRequestMessage requestMessage ) : HttpRequestMessage
GetHttpClient ( ) : IHttpClient

Method Details

FireAsync() protected method

Send a http request with special header to loop back address to by pass the cache
protected FireAsync ( ) : Task
return Task

GetTargetInstance() protected method

Not support in WebAPI
protected GetTargetInstance ( ICacheDependencyScope scope ) : object
scope ICacheDependencyScope
return object

WebApiPhoenix() public method

Initializes a WebApiPhoenix
public WebApiPhoenix ( _IInvocation invocation, WebApiCacheItem cacheItem, HttpRequestMessage originalRequestMessage ) : System
invocation _IInvocation
cacheItem WebApiCacheItem This should the the WebApiCacheItem instance
originalRequestMessage System.Net.Http.HttpRequestMessage
return System