SystemLibrary.Common.Framework.App
Classes
ActionContextInstance
An implementation of the 'old' thread safe singleton ActionContext we all know and love from .NET Framework
BaseApiController
Inherit BaseApiController to get an automatic documentation of all your api endpoints
All controllers inheriting BaseApiController are automatically picked up if matching the request path
Cache
Caching for applications
Default duration is 3 minutes
Try using auto-generating cache keys, which differentiate caching down to user roles.- Cache things per user, by userId/email? Create your own cacheKey
'Ignore' means the function will always be invoked directly, bypassing the cache entirely.
Skip options:- skipWhenAuthenticated, false by default
- skipWhenAdmin, true by defaultThe user must belong to one of the following case-sensitive roles: Admin, Admins, Administrator, Administrators, WebAdmins, CmsAdmins, admin, admins, administrator, administrators.
- skipWhen, your own condition, must return True to skipThe Callee Cancelled Request Exception is thrown when the callee (you) cancel's the request.
- To cancel a request you must pass a 'Cancellation Token', and then cancel the request through the Cancellation Token
Client
Client is a class for all http(s) requests in your project
Uses HttpClient and Polly behind the scenes for features such as reusing tcp connections, retry on 502 and 504 status codes, and optionally a request breaker for 7 seconds, if 25 error codes (404, 429, 500, 502, 503, 504, 505) occurs in a row
useRetryPolicy: false, will retry once if request is a file request or GET or POST and status code is 502 or 504Options:
useRetryPolicy:True: same as 'false', but adds:
- retries one additional time on 502, 504 GET, POST- retries up to two times if response is null (timeout/no response)
- retries once on 401 GET, POST- retries once on 404 GET
- retries once on 500 GET, POST- retries once on 404, 500, 502 504 file request
- retries once on OPTION, PATCH, HEAD, CONNECT, TRACEBase class of a ClientResponse
- Contains the HttpResponseMessage itself
Used when you do not want to return 'object' nor generic type, but you want to be clear in what object is returned in your C# functions- Contains 'data' variable for serializing purposes, so 'data' variable is never undefined in JS world (depends on the JSON serialization options youve set, but out of the box its null if not set)
ClientResponse<T>
The response that all Client methods returns
Note that a response statuscode might be 200 OK, but the IsSuccess might be false in scenarios where no response were returned
HtmlHelperFactory
HtmlHelperFactory builds a new instance of IHtmlBuilder outside of your View Context
Add any OutputCachePolicy to the OutputCache attribute in the 'PolicyName' property
Requires framework option UseControllers or UseMvc to be true
Services
Services is a global way to reuse the configured service provider and collection
Enums
CacheDuration
An enum of various media types that can be sent to the Client request methods
The 'ContentType' is sent as an 'Accept' HEADER in the request
NOTE: Not all of them have been implemented yet though, but all will be sent as 'ACCEPT' header if specified, if you specify ContentType.none, no accept header is sent