-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create HttpCachePolicyBase, fix HttpResponseBase.Cache typing (#477)
- Loading branch information
Showing
6 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Microsoft.AspNetCore.SystemWebAdapters/HttpCachePolicyBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace System.Web; | ||
|
||
public class HttpCachePolicyBase | ||
{ | ||
[SuppressMessage("Design", "CA1065:Do not raise exceptions in unexpected locations", Justification = Constants.ApiFromAspNet)] | ||
public virtual HttpCacheVaryByHeaders VaryByHeaders => throw new NotImplementedException(); | ||
|
||
public virtual void SetCacheability(HttpCacheability cacheability) => throw new NotImplementedException(); | ||
|
||
public virtual void SetCacheability(HttpCacheability cacheability, string field) => throw new NotImplementedException(); | ||
|
||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Date", | ||
Justification = "Matches HttpCachePolicy class")] | ||
public virtual void SetLastModified(DateTime date) => throw new NotImplementedException(); | ||
|
||
public virtual void SetMaxAge(TimeSpan delta) => throw new NotImplementedException(); | ||
|
||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Date", | ||
Justification = "Matches HttpCachePolicy class")] | ||
public virtual void SetExpires(DateTime date) => throw new NotImplementedException(); | ||
|
||
public virtual void SetOmitVaryStar(bool omit) => throw new NotImplementedException(); | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Microsoft.AspNetCore.SystemWebAdapters/HttpCachePolicyWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Web; | ||
|
||
public class HttpCachePolicyWrapper : HttpCachePolicyBase | ||
{ | ||
private HttpCachePolicy _httpCachePolicy; | ||
|
||
public HttpCachePolicyWrapper(HttpCachePolicy httpCachePolicy) | ||
{ | ||
if (httpCachePolicy == null) | ||
{ | ||
ArgumentNullException.ThrowIfNull(httpCachePolicy); | ||
} | ||
_httpCachePolicy = httpCachePolicy; | ||
} | ||
|
||
|
||
public override HttpCacheVaryByHeaders VaryByHeaders => _httpCachePolicy.VaryByHeaders; | ||
|
||
public override void SetCacheability(HttpCacheability cacheability) => _httpCachePolicy.SetCacheability(cacheability); | ||
|
||
public override void SetExpires(DateTime date) => _httpCachePolicy.SetExpires(date); | ||
|
||
public override void SetLastModified(DateTime date) => _httpCachePolicy.SetLastModified(date); | ||
|
||
public override void SetMaxAge(TimeSpan delta) => _httpCachePolicy.SetMaxAge(delta); | ||
|
||
public override void SetOmitVaryStar(bool omit) => _httpCachePolicy.SetOmitVaryStar(omit); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters