/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> protected override bool TryGetConvention(MethodInfo method, [NotNullWhen(true)] out IApiVersionConvention <ActionModel>?convention) { if (ActionBuilders.TryGetValue(method, out var actionBuilder) && actionBuilder != null) { return((convention = actionBuilder) != null); } convention = default; return(false); }
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> protected override bool TryGetConvention(MethodInfo method, out IApiVersionConvention <ActionModel>?convention) { if (ActionBuilders.TryGetValue(method, out var actionBuilder)) { convention = actionBuilder; return(true); } convention = default; return(false); }
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> protected override bool TryGetConvention(MethodInfo method, out IApiVersionConvention <HttpActionDescriptor>?convention) { if (ActionBuilders.TryGetValue(method, out var builder)) { convention = builder; return(true); } convention = default; return(false); }
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. protected override bool TryGetConvention(MethodInfo method, out IApiVersionConvention <ActionModel>?convention) #pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. { if (ActionBuilders.TryGetValue(method, out var actionBuilder)) { convention = actionBuilder; return(true); } convention = default; return(false); }
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> protected override bool TryGetConvention(MethodInfo method, out IApiVersionConvention <HttpActionDescriptor> convention) { Arg.NotNull(method, nameof(method)); if (ActionBuilders.TryGetValue(method, out var builder)) { convention = builder; return(true); } convention = default(IApiVersionConvention <HttpActionDescriptor>); return(false); }
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> protected abstract bool TryGetConvention(MethodInfo method, out IApiVersionConvention <ActionModel> convention);
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> protected abstract bool TryGetConvention(MethodInfo method, out IApiVersionConvention <HttpActionDescriptor>?convention);
/// <summary> /// Attempts to get the convention for the specified action method. /// </summary> /// <param name="method">The <see cref="MethodInfo">method</see> representing the action to retrieve the convention for.</param> /// <param name="convention">The retrieved <see cref="IApiVersionConvention{T}">convention</see> or <c>null</c>.</param> /// <returns>True if the convention was successfully retrieved; otherwise, false.</returns> #if NETCOREAPP3_1 protected override bool TryGetConvention(MethodInfo method, [NotNullWhen(true)] out IApiVersionConvention <ActionModel>?convention)