mirror of https://github.com/abpframework/abp.git
9 changed files with 94 additions and 9 deletions
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 160 KiB |
@ -0,0 +1,22 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.PlugIn; |
||||
|
|
||||
|
[DependsOn(typeof(AbpAspNetCoreMvcUiThemeSharedModule))] |
||||
|
public class MyPlungInModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
||||
|
{ |
||||
|
//Add plugin assembly
|
||||
|
mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(typeof(MyPlungInModule).Assembly)); |
||||
|
|
||||
|
//Add CompiledRazorAssemblyPart if the PlugIn module contains razor views.
|
||||
|
mvcBuilder.PartManager.ApplicationParts.Add(new CompiledRazorAssemblyPart(typeof(MyPlungInModule).Assembly)); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<OutputType>Library</OutputType> |
||||
|
<IsPackable>true</IsPackable> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,4 @@ |
|||||
|
@page |
||||
|
@model Volo.Abp.AspNetCore.Mvc.PlugIn.Volo.Abp.AspNetCore.Mvc.Index |
||||
|
<h1>Welcome to my plug-in page</h1> |
||||
|
<p>This page is located inside a plug-in module! :)</p> |
||||
@ -0,0 +1,11 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.PlugIn.Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
public class Index : PageModel |
||||
|
{ |
||||
|
public void OnGet() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Shouldly; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.PlugIn; |
||||
|
|
||||
|
public class PlugIn_Tests : AspNetCoreMvcTestBase |
||||
|
{ |
||||
|
[Fact] |
||||
|
public async Task Get_PlugIn_Views() |
||||
|
{ |
||||
|
var page = await GetResponseAsStringAsync( |
||||
|
"/Index" |
||||
|
); |
||||
|
|
||||
|
page.ShouldContain("Welcome to my plug-in page"); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue