Blazor Server
LeptonX has "system" as default and system refer to "light" and "dark" ( hardcoded in js code ).
we had a similar problem when trying to override "dark" and "light". our solution was to redirect these url's.
private void RedirectTheme( IApplicationBuilder app, string file, bool boostrap = false )
{
const string originalPath = "/_content/Volo.Abp.AspNetCore.Components.Web.LeptonXTheme/side-menu/css/";
const string targetPath = "/themes/";
const string bootstrap = "bootstrap-";
RedirectFile( app, originalPath + file, targetPath + file );
if( boostrap )
{
RedirectFile( app, originalPath + bootstrap + file, targetPath + bootstrap + file );
}
}
private void RedirectFile( IApplicationBuilder app, string originalPath, string targetPath )
{
app.Map( originalPath, redirectBuilder => redirectBuilder.Run( request =>
{
request.Response.Redirect( targetPath );
return Task.CompletedTask;
} ) );
}
found out: its only copied if you use correct path, _content/{PackeId}/{Path}
not sure why you dont need to specify _conent in main project but it works
main project - Pages/Test.razor
@page "/test"
<h3>Test</h3>
@code {
private Lazy<IJSObjectReference> _module = new();
private Lazy<IJSObjectReference> _moduleInstance = new();
private DotNetObjectReference<Test>? _reference;
[Inject]
private IJSRuntime _js { get; set; } = null!;
protected override async Task OnAfterRenderAsync( bool firstRender )
{
if( !firstRender )
{
return;
}
IJSObjectReference jsModule = await _js.InvokeAsync<IJSObjectReference>( "import", "./Pages/Test.razor.js" );
_reference = DotNetObjectReference.Create( this );
_module = new Lazy<IJSObjectReference>( jsModule );
_moduleInstance = new Lazy<IJSObjectReference>( await _module.Value.InvokeAsync<IJSObjectReference>( "GetExample" ) );
}
}
main project - Pages/Test.razor.js
class Example
{
}
let instance = new Example();
export function GetExample()
{
return instance;
}
module project - Pages/ModuleTest.razor
@page "/module/test"
@using Microsoft.JSInterop
<h3>Test</h3>
@code {
private Lazy<IJSObjectReference> _module = new();
private Lazy<IJSObjectReference> _moduleInstance = new();
private DotNetObjectReference<ModuleTest>? _reference;
[Inject]
private IJSRuntime _js { get; set; } = null!;
protected override async Task OnAfterRenderAsync( bool firstRender )
{
if( !firstRender )
{
return;
}
IJSObjectReference jsModule = await _js.InvokeAsync<IJSObjectReference>( "import", "./Pages/ModuleTest.razor.js" );
_reference = DotNetObjectReference.Create( this );
_module = new Lazy<IJSObjectReference>( jsModule );
_moduleInstance = new Lazy<IJSObjectReference>( await _module.Value.InvokeAsync<IJSObjectReference>( "GetExample" ) );
}
}
module project - Pages/ModuleTest.razor.js
class Example
{
}
let instance = new Example();
export function GetExample()
{
return instance;
}
ok, thanks
Blazor (server) - project was created with suite 6.0.0
i belive there are two bugs that should be fixed:
AddDefaultRepository
on an entity which is part of an context with ReplaceDbContext
prevents this entity from being part of the target contextIReadOnlyRepository
in application services for entities with IMultiTenant
get the host context instead of the tenant context when they do not have a custom repositoryFound the last problem: you need a custom repository, it looks like MultiTenant doesnt work with default genrated repository
With custom repository and multi-tenant, all entities are on the same context, finally.
Found one problem: options.AddDefaultRepository<TEntity>
prevents ReplaceDbContext
to work
But ExampleEntity still in host context and user in tenant context