-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add PineBlogViewDataAsyncPageFilter * Get the connection string by the connextion name
- Loading branch information
1 parent
2cdd9e8
commit 4d0caa6
Showing
25 changed files
with
127 additions
and
83 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
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
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
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
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
6 changes: 5 additions & 1 deletion
6
src/Opw.PineBlog.RazorPages/Areas/Admin/Pages/Shared/_Footer.cshtml
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<footer class="footer copy"> | ||
<div class="container d-lg-flex text-center text-lg-left"> | ||
<p><a href="https://github.com/ofpinewood/pineblog">PineBlog</a> © @DateTime.Now.Year Of Pine Wood (@ViewData["ApplicationVersion"])</p> | ||
<p> | ||
Powered by <a href="https://github.com/ofpinewood/pineblog">PineBlog</a> | ||
© @DateTime.Now.Year <a href="https://github.com/ofpinewood">Of Pine Wood</a> | ||
(@ViewData["PineBlogVersion"]) | ||
</p> | ||
</div> | ||
</footer> |
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
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
6 changes: 5 additions & 1 deletion
6
src/Opw.PineBlog.RazorPages/Areas/Blog/Pages/Shared/_Footer.cshtml
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
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
57 changes: 57 additions & 0 deletions
57
src/Opw.PineBlog.RazorPages/PineBlogViewDataAsyncResultFilter.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,57 @@ | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using Microsoft.Extensions.Options; | ||
using System.Threading.Tasks; | ||
|
||
namespace Opw.PineBlog.RazorPages | ||
{ | ||
/// <summary> | ||
/// A filter that asynchronously sets the ViewData of a page. | ||
/// </summary> | ||
public class PineBlogViewDataAsyncPageFilter : IAsyncPageFilter | ||
{ | ||
private readonly IOptions<PineBlogOptions> _options; | ||
|
||
/// <summary> | ||
/// Implementation of PineBlogViewDataAsyncPageFilter. | ||
/// </summary> | ||
/// <param name="options">Blog options.</param> | ||
public PineBlogViewDataAsyncPageFilter(IOptions<PineBlogOptions> options) | ||
{ | ||
_options = options; | ||
} | ||
|
||
/// <summary> | ||
/// Called asynchronously before the handler method is invoked, after model binding is complete. | ||
/// </summary> | ||
/// <param name="context">The <see cref="PageHandlerExecutingContext" />.</param> | ||
/// <param name="next"> | ||
/// The <see cref="PageHandlerExecutionDelegate" />. Invoked to execute the next page filter or the handler method itself. | ||
/// </param> | ||
/// <returns>A <see cref="Task" /> that on completion indicates the filter has executed.</returns> | ||
public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) | ||
{ | ||
var pageModel = context.HandlerInstance as PageModel; | ||
if (pageModel == null) | ||
{ | ||
await next(); | ||
return; | ||
} | ||
|
||
pageModel.ViewData["PineBlogVersion"] = _options.Value.Version; | ||
pageModel.ViewData["Title"] = _options.Value.Title; | ||
|
||
await next(); | ||
} | ||
|
||
/// <summary> | ||
/// Called asynchronously after the handler method has been selected, but before model binding occurs. | ||
/// </summary> | ||
/// <param name="context">The <see cref="PageHandlerSelectedContext" />.</param> | ||
/// <returns>A <see cref="Task" /> that on completion indicates the filter has executed.</returns> | ||
public async Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) | ||
{ | ||
await Task.CompletedTask; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.