IntelligentPlant.Relativity.Owin 2.0.0

dotnet add package IntelligentPlant.Relativity.Owin --version 2.0.0                
NuGet\Install-Package IntelligentPlant.Relativity.Owin -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IntelligentPlant.Relativity.Owin" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IntelligentPlant.Relativity.Owin --version 2.0.0                
#r "nuget: IntelligentPlant.Relativity.Owin, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IntelligentPlant.Relativity.Owin as a Cake Addin
#addin nuget:?package=IntelligentPlant.Relativity.Owin&version=2.0.0

// Install IntelligentPlant.Relativity.Owin as a Cake Tool
#tool nuget:?package=IntelligentPlant.Relativity.Owin&version=2.0.0                

IntelligentPlant.Relativity.Owin

This package provides OWIN middleware for setting RelativityParser.Current for an HTTP request. This allows timestamps and durations to be parsed anywhere in the request using RelativityParser.Current.

Getting Started

The middleware uses time zone providers (derived from TimeZoneProvider) to determine the time zone to use when configuring the Relativity parser for the request. Use the extension methods defined in AppBuilderExtensions to register the middleware, IRelativityParserFactory and the time zone providers to use:

app.UseRelativity(RelativityParserFactory.Default,
    // Set time zone using 'tz' query string parameter
    new QueryStringTimeZoneProvider(),
    // Set time zone using 'X-TimeZone' request header
    new RequestHeaderTimeZoneProvider());

Unlike the ASP.NET Core package, the time zone providers are always run in the order that they are specified. The first time zone provider that returns a valid time zone will be used. If no time zone provider returns a valid time zone, UTC will be used.

Note that OWIN does not have built-in capababilities for setting CultureInfo.CurrentCulture or CultureInfo.CurrentUICulture for the current request. Therefore, you will need to set these manually in the application pipeline prior to the Relativity middleware if you want to allow culture-specific Relativity parsers to be used based on e.g. the Accept-Language header specified by the calling user agent.

Using the Parser

You can access the parser for the current request using RelativityParser.Current. For example:

var dt = RelativityParser.Current.ConvertToUtcDateTime("DAY+6H");
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 79 10/22/2024
2.0.0-pre.13 49 10/21/2024
2.0.0-pre.12 45 10/21/2024
2.0.0-pre.11 81 3/1/2024
2.0.0-pre.10 55 2/29/2024
2.0.0-pre.9 61 2/29/2024
2.0.0-pre.8 50 2/29/2024
2.0.0-pre.7 58 2/29/2024
2.0.0-pre.4 49 2/29/2024
2.0.0-pre.3 52 2/28/2024