Activities of "maliming"

hi

You can try the code below


public async Task HandleEventAsync(ProductEto eventData)
{
    if (eventData != null)
    {
        using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true))
        {
            _currentTenant.Change(eventData.TenantId);
            try
            {
                var gmd = _objectMapper.Map<ProductEto, ProductSync>(eventData);

                await _productSyncRepository.InsertAsync(gmd);
                await unitOfWork.CompleteAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, "Handle Event ProductEto Error");
            }
        }
    }
    else
    {
        Logger.LogWarning("Input data is null into handle event ProductEto");
    }
}

https://github.com/abpframework/abp/pull/19870

hi

Try to add a CachedDynamicFileProvider class to get files from Redis cache.

CachedDynamicFileProvider:

using System;
using System.Collections.Generic;
using Microsoft.Extensions.FileProviders;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.VirtualFileSystem;

namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;

[Dependency(ReplaceServices = true)]
public class CachedDynamicFileProvider : DynamicFileProvider
{
    protected IDistributedCache<InMemoryFileInfoCacheItem> Cache { get; }

    public CachedDynamicFileProvider(IDistributedCache<InMemoryFileInfoCacheItem> cache)
    {
        Cache = cache;
    }

    public override IFileInfo GetFileInfo(string? subpath)
    {
        if (subpath == null)
        {
            return new NotFoundFileInfo(subpath!);
        }

        var file = DynamicFiles.GetOrDefault(NormalizePath(subpath));
        if (file == null && (subpath.Contains(".js", StringComparison.OrdinalIgnoreCase) || subpath.Contains(".css", StringComparison.OrdinalIgnoreCase)))
        {
            var cacheItem = Cache.Get(NormalizePath(subpath));
            if (cacheItem == null)
            {
                return new NotFoundFileInfo(subpath);
            }

            var inMemoryFile = new InMemoryFileInfo(NormalizePath(subpath), cacheItem.FileContent, cacheItem.Name);
            DynamicFiles.AddOrUpdate(NormalizePath(subpath), inMemoryFile, (key, value) => inMemoryFile);
            return inMemoryFile;
        }

        return file ?? new NotFoundFileInfo(subpath);
    }

    public override void AddOrUpdate(IFileInfo fileInfo)
    {
        var filePath = fileInfo.GetVirtualOrPhysicalPathOrNull();
        Cache.GetOrAdd(filePath!, () => new InMemoryFileInfoCacheItem(filePath!, fileInfo.ReadBytes(), fileInfo.Name));
        DynamicFiles.AddOrUpdate(filePath!, fileInfo, (key, value) => fileInfo);
        ReportChange(filePath!);
    }

    public override bool Delete(string filePath)
    {
        Cache.Remove(filePath);
        if (!DynamicFiles.TryRemove(filePath, out _))
        {
            return false;
        }

        ReportChange(filePath);
        return true;
    }
}

InMemoryFileInfoCacheItem

using System;
using Volo.Abp.MultiTenancy;

namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;

[Serializable]
[IgnoreMultiTenancy]
public class InMemoryFileInfoCacheItem
{
    public InMemoryFileInfoCacheItem(string dynamicPath, byte[] fileContent, string name)
    {
        DynamicPath = dynamicPath;
        Name = name;
        FileContent = fileContent;
    }

    public string DynamicPath { get; set; }

    public string Name { get; set; }

    public byte[] FileContent { get; set; }
}

Answer

Great

hi

You can inject the ILanguageTextRepository to maintain(get/set) your localization info.

Answer

hi

You can try that:

app.Use(async (httpContext, next) =>
{
    if (!httpContext.Request.Path.ToString().Contains("account/login"))
    {
        if (httpContext.User.Identity is not { IsAuthenticated: true })
        {
            ///crm-aday-details?adayId=4503#0
            var path = httpContext.Request.GetEncodedPathAndQuery();
            if (path.IsNullOrWhiteSpace() || path == "/")
            {
                httpContext.Response.Redirect("/account/login");
            }
            else
            {
                httpContext.Response.Redirect("/account/login?returnUrl=" + path);
            }

            return;
        }
    }

    await next();
});
Answer
var yourPage = get page(querystring) from httpcontext
httpContext.Response.Redirect("/account/login?returnUrl=" + yourPage);

Thank you for the information. I will check it out in depth.

ok, I will check it.

Answer

hi

You can use the URL like: https://localhost:44309/account/login?returnUrl=/MyPage The returnUrl parameter can do this.

Showing 4811 to 4820 of 11529 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 17, 2025, 07:08
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.