WorkContext MembersNFX Class Library

[This is preliminary documentation and is subject to change.]

The WorkContext type exposes the following members.
Constructors

  NameDescription
Protected methodWorkContext
Initializes a new instance of the WorkContext class
Back to Top
Methods

  NameDescription
Public method___InternalInjectPortal
DEVELOPERS do not use! A hack method needed in some VERY RARE cases, like serving an error page form the filter which is out of portal scope.
Protected method___SetWorkMatch
Internal method. Developers do not call
Protected methodDestructor
Warning: if overridden, must call base otherwise semaphore will not get released
(Overrides DisposableObject Destructor .)
Public methodDispose
Deterministically disposes object. DO NOT OVERRIDE this method, override Destructor() instead
(Inherited from DisposableObject.)
Public methodEnsureObjectNotDisposed
Checks to see whether object dispose started or has already been disposed and throws an exception if Dispose() was called
(Inherited from DisposableObject.)
Public methodOnlineEquals
Determines whether the specified object is equal to the current object.
(Inherited from OnlineObject.)
Protected methodFinalize (Inherited from DisposableObject.)
Public methodOnlineGetHashCode
Serves as the default hash function.
(Inherited from OnlineObject.)
Public methodOnlineGetType
Gets the OnlineType of the current instance.
(Inherited from OnlineObject.)
Protected methodGetWholeRequestAsJSONDataMap
Converts request body and MatchedVars into a single JSONDataMap. Users should call WholeRequestAsJSONDataMap.get() as it caches the result
Public methodHasAnyVarsMatchingFieldNames
Returns true if the whole request (body or matched vars) contains any names matching any field names of the specified row
Public methodLog
Facilitates context-aware logging
Protected methodOnlineMemberwiseClone
Creates a shallow copy of the current OnlineObject.
(Inherited from OnlineObject.)
Public methodNeedsSession
Ensures that session is injected if session filter is present in processing chain. If session is already available (Session!=null) then does nothing, otherwise fills Session poroperty with either NEW session (if onlyExisting=false(default)) if user supplied no session token, OR gets session from session store as defined by the first SessionFilter in the chain
Protected methodParseRequestBodyAsJSONDataMap
This method is called only once as it touches the input streams
Public methodReleaseWorkSemaphore
Releases work semaphore that throttles the processing of WorkContext instances. The WorkContext is released automatically in destructor, however there are cases when the semaphore release may be needed sooner, i.e. in a HTTP streaming application where work context instances are kept open indefinitely it may not be desirable to consider long-living work context instances as a throtteling factor. Returns true if semaphore was released, false if it was not released during this call as it was already released before
Public methodSetAuthenticated
Invoked by applications to signify the presence of authentication
Public methodToString (Overrides OnlineObject ToString .)
Back to Top
Extension Methods

  NameDescription
Public Extension MethodAsBool (Defined by ObjectValueConversion.)
Public Extension MethodAsByte (Defined by ObjectValueConversion.)
Public Extension MethodAsChar (Defined by ObjectValueConversion.)
Public Extension MethodAsDateTime Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsDateTime(DateTime, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsDecimal (Defined by ObjectValueConversion.)
Public Extension MethodAsDouble (Defined by ObjectValueConversion.)
Public Extension MethodAsEnum TEnum  (Defined by ObjectValueConversion.)
Public Extension MethodAsFloat (Defined by ObjectValueConversion.)
Public Extension MethodAsGDID Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGDID(GDID, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGDIDSymbol Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGDIDSymbol(GDIDSymbol, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGUID (Defined by ObjectValueConversion.)
Public Extension MethodAsInt (Defined by ObjectValueConversion.)
Public Extension MethodAsJSONConfig (Defined by ObjectValueConversion.)
Public Extension MethodAsLaconicConfig (Defined by ObjectValueConversion.)
Public Extension MethodAsLong (Defined by ObjectValueConversion.)
Public Extension MethodAsNonNullOrEmptyString (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableBool (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableByte (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableChar (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableDateTime (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableDecimal (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableDouble (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableEnum TEnum  (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableFloat (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableGDID (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableGDIDSymbol (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableGUID (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableInt (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableLong (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableSByte (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableShort (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableTimeSpan (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableUInt (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableULong (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableUShort (Defined by ObjectValueConversion.)
Public Extension MethodAsSByte (Defined by ObjectValueConversion.)
Public Extension MethodAsShort (Defined by ObjectValueConversion.)
Public Extension MethodAsString (Defined by ObjectValueConversion.)
Public Extension MethodAsTimeSpan Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsTimeSpan(TimeSpan, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsUInt (Defined by ObjectValueConversion.)
Public Extension MethodAsULong (Defined by ObjectValueConversion.)
Public Extension MethodAsUri (Defined by ObjectValueConversion.)
Public Extension MethodAsUShort (Defined by ObjectValueConversion.)
Public Extension MethodAsXMLConfig (Defined by ObjectValueConversion.)
Public Extension MethodToErlObject Overloaded.
Try to convert .NET native object type to corresponding Erlang term. Throw exception if conversion is not possible
(Defined by ErlObject.)
Public Extension MethodToErlObject(ErlTypeOrder, Boolean)Overloaded.
Try to convert .NET native object type to corresponding Erlang term of given type. Throw exception if conversion is not possible
(Defined by ErlObject.)
Public Extension MethodToJSON(JSONWritingOptions)Overloaded.
Serializes object into JSON string
(Defined by JSONExtensions.)
Public Extension MethodToJSON(TextWriter, JSONWritingOptions)Overloaded.
Serializes object into JSON format using provided TextWriter
(Defined by JSONExtensions.)
Public Extension MethodToJSON(Stream, JSONWritingOptions, Encoding)Overloaded.
Serializes object into JSON format using provided stream and optional encoding
(Defined by JSONExtensions.)
Back to Top
Fields

  NameDescription
Protected fieldm_EffectiveCallerIPEndPoint
Protected fieldm_Handled
Protected fieldm_Handler
Protected fieldm_Portal
Protected fieldm_PortalFilter
Protected fieldm_PortalMatch
Protected fieldm_PortalMatchedVars
Protected fieldm_PortalTheme
Protected fieldm_Session
Protected fieldm_SessionFilter
Back to Top
Properties

  NameDescription
Public propertyAborted
Indicates whether the work context is logically finished and its nested processing (i.e. through Filters/Handlers) should stop. For example, when some filter detects a special condition (judging by the request) and generates the response and needs to abort the work request so it does no get filtered/processed anymore, it can set this property to true. This mechanism performs much better than throwing exceptions
Public propertyAbout
Generates short context description
Public propertyDisposed
Indicates whether this object was already disposed - the Dispose() has finished
(Inherited from DisposableObject.)
Public propertyDisposeStarted
Indicates whether this object Dispose() has been called and dispose started but not finished yet
(Inherited from DisposableObject.)
Public propertyEffectiveCallerIPEndPoint
Returns the effective caller endpoint- that is, if the real caller filter is set it will inject the real IP as seen before any proxy devices. By default this property returns the Request.RemoteEndPoint
Public propertyGeoEntity
Gets sets geo location information as detected by GeoLookupHandler. If Session context is injected then get/set passes through into session object
Public propertyHandled
Returns true when the work has been executed by the WorkHandler instance
Public propertyHandler
Returns the work handler instance that was matched to perform work on this context or null if the match has not been made yet
Public propertyID
Uniquely identifies the request
Public propertyIsAuthenticated
Returns true to indicate that this context is/was authenticated. Used to not redirect users to login page on authorization exception
Public propertyIsDELETE
Indicates that request method id DELETE
Public propertyIsGET
Indicates that request method id GET
Public propertyIsPATCH
Indicates that request method id PATCH
Public propertyIsPOST
Indicates that request method id POST
Public propertyIsPUT
Indicates that request method id PUT
Public propertyItems
Provides a thread-safe dictionary of items. The underlying collection is lazily allocated
Public propertyLastError
Captures last error
Public propertyMatch
Returns the work match instances that was made for this requested work or null if nothing was matched yet
Public propertyMatched
Returns dynamic object that contains variables that have been extracted by WorkMatch when dispatcher assigned request to WorkHandler. If variables have not been assigned yet returns empty object
Public propertyMatchedVars
Returns variables that have been extracted by WorkMatch when dispatcher assigned request to WorkHandler. If variables have not been assigned yet returns empty object
Public propertyNoDefaultAutoClose
Indicates whether the default dispatcher should close the WorkContext upon completion of async processing. This property may ONLY be set to TRUE IF Response.Buffered = false (chunked transfer) and Response has already been written to. When this property is set to true the WorkDispatcher will not auto dispose this WorkContext instance. This may be needed for a server that streams chat messages and some other thread manages the lifetime of this WorkContext. Keep in mind that alternative implementations of WorkDispatcher (derived classes that implement alternative threading/lifecycle) may disregard this flag altogether
Public propertyPortal
Returns portal object for this request or null if no portal was injected
Public propertyPortalFilter
Returns the first portal filter which was injected in the processing line. It is the filter that manages the portals for this context
Public propertyPortalMatch
Returns matched that was made by portal filter or null
Public propertyPortalMatchedVars
Returns variables that have been extracted by WorkMatch when PortalFilter assigned portal. Returns null if no portal was matched
Public propertyPortalTheme
Gets/sets portal theme. This may be null as this is just a holder variable
Public propertyRequest
Returns HttpListenerRequest object for this context
Public propertyRequestBodyAsJSONDataMap
Fetches request body: multipart content, url encoded content, or JSON body into one JSONDataMap bag, or null if there is no body. The property does caching
Public propertyRequestedJSON
Returns true if client indicated in response that "application/json" is accepted
Public propertyResponse
Returns Response object for this context
Public propertyServer
Returns the server this context is under
Public propertySession
Returns session that this context is linked with or null
Public propertySessionFilter
Returns the first session filter which was injected in the processing line. It is the filter that manages the session state for this context
Public propertySupportsSession
Returns true when the context was configured to support SessionFilter so Session can be injected
Public propertyWholeRequestAsJSONDataMap
Fetches matched vars, multipart content, url encoded content, or JSON body into one JSONDataMap bag. The property does caching
Public propertyWorkSemaphoreReleased
Returns true to indicate that work semaphore has been already released. It is not necessary to use this property or ReleaseWorkSemaphore() method as the framework does it automatically in 99% cases. ReleaseWorkSemaphore() may need to be called from special places like HTTP streaming servers that need to keep WorkContext instances open for a long time
Back to Top
See Also