Browse Source

Ignore _blazor endpoint for blazor server side applications (temp solution).

Will be improved later.
pull/8074/head
Halil İbrahim Kalkan 6 years ago
parent
commit
804d5f20ee
  1. 1
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs
  2. 8
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs
  3. 3
      modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
  4. 11
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/_Host.cshtml
  5. 19
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/wwwroot/global-styles.css

1
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs

@ -4,7 +4,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Uow;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow; using Volo.Abp.Uow;

8
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs

@ -16,6 +16,14 @@ namespace Volo.Abp.AspNetCore.Uow
public async Task InvokeAsync(HttpContext context, RequestDelegate next) public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{ {
//TODO: Make this configurable.
if (context.Request.Path.Value != null &&
context.Request.Path.Value.StartsWith("/_blazor"))
{
await next(context);
return;
}
using (var uow = _unitOfWorkManager.Reserve(UnitOfWork.UnitOfWorkReservationName)) using (var uow = _unitOfWorkManager.Reserve(UnitOfWork.UnitOfWorkReservationName))
{ {
await next(context); await next(context);

3
modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
@ -109,8 +108,6 @@ namespace Volo.Abp.PermissionManagement
{ {
await PermissionManager.SetAsync(permissionDto.Name, providerName, providerKey, permissionDto.IsGranted); await PermissionManager.SetAsync(permissionDto.Name, providerName, providerKey, permissionDto.IsGranted);
} }
await CurrentUnitOfWork.SaveChangesAsync();
} }
protected virtual async Task CheckProviderPolicy(string providerName) protected virtual async Task CheckProviderPolicy(string providerName)

11
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/_Host.cshtml

@ -19,6 +19,17 @@
<body> <body>
<component type="typeof(App)" render-mode="Server" /> <component type="typeof(App)" render-mode="Server" />
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<abp-script-bundle name="@BlazorBasicThemeBundles.Scripts.Global" /> <abp-script-bundle name="@BlazorBasicThemeBundles.Scripts.Global" />
</body> </body>
</html> </html>

19
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/wwwroot/global-styles.css

@ -1 +1,18 @@
/* Your Global Styles */ #blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
}
#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
}

Loading…
Cancel
Save