mirror of https://github.com/abpframework/abp.git
3 changed files with 38 additions and 4 deletions
@ -0,0 +1,19 @@ |
|||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.ApiVersioning; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.Versioning |
||||
|
{ |
||||
|
public class HttpContextRequestedApiVersion : IRequestedApiVersion, ITransientDependency |
||||
|
{ |
||||
|
public string Current => _httpContextAccessor.HttpContext?.GetRequestedApiVersion().ToString(); |
||||
|
|
||||
|
private readonly IHttpContextAccessor _httpContextAccessor; |
||||
|
|
||||
|
public HttpContextRequestedApiVersion(IHttpContextAccessor httpContextAccessor) |
||||
|
{ |
||||
|
_httpContextAccessor = httpContextAccessor; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace Volo.Abp.ApiVersioning |
||||
|
{ |
||||
|
public interface IRequestedApiVersion |
||||
|
{ |
||||
|
string Current { get; } |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue