InvalidItemFactoryRegister Method |
Register an invalid item.
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static IReturnValue Register(
IContext context,
InvalidItemKey key,
string value,
Nullable<DateTime> expiry = null
)
Public Shared Function Register (
context As IContext,
key As InvalidItemKey,
value As String,
Optional expiry As Nullable(Of DateTime) = Nothing
) As IReturnValue
public:
static IReturnValue^ Register(
IContext^ context,
InvalidItemKey key,
String^ value,
Nullable<DateTime> expiry = nullptr
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Context of execution. - key
- Type: AskiaPortalCmnInvalidItemKey
Key of the item to search. - value
- Type: SystemString
Value of the item to search. - expiry (Optional)
- Type: SystemNullableDateTime
Indicates the expiry date until the item is consider invalid. Set null for unlimited.
Return Value
Type:
IReturnValue
Return fail result if the user in the context doesn't have
enough right to perform this operation.
Remarks
This method will directly save the operation in the database.
Examples
Register an invalid session.
var result InvalidItemFactory.Register(context, InvalidItemKey.Session, context.SessionKey, DateTime.UtcNow.AddDays(3));
if (!result.Success)
{
Console.Error.WriteLine("Could not invalidate the session key");
return;
}
Console.WriteLine($"The session key is now invalid.");
See Also