Activities of "cala"

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

oh, we didnt enabled it for the host :/ makes sense that it doesnt show up.

but it looks like one localization is missing ( v6.0.1 ):

i belive there are two bugs that should be fixed:

  1. AddDefaultRepository on an entity which is part of an context with ReplaceDbContext prevents this entity from being part of the target context
  2. injected default repositories like IReadOnlyRepository in application services for entities with IMultiTenant get the host context instead of the tenant context when they do not have a custom repository

Found 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

Showing 21 to 30 of 42 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13