public RouteVersionConstraint(string version, bool isDefault, RouteVersionsOptions options) { Version = version ?? throw new ArgumentNullException(nameof(version)); IsDefault = isDefault; _options = options ?? throw new ArgumentNullException(nameof(options)); _acceptHeaderRegex = new Regex(options.AcceptRegexPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); }
public static void ConfigureRouteVersions( this IServiceCollection services, RouteVersionsOptions options) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } services.TryAddSingleton(options); }
public static void ConfigureRouteVersions( this IServiceCollection services, Action <RouteVersionsOptions> configureRouteVersions) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (configureRouteVersions == null) { throw new ArgumentNullException(nameof(configureRouteVersions)); } var options = new RouteVersionsOptions(); configureRouteVersions(options); services.ConfigureRouteVersions(options); }