Activities of "maliming"

hi

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Options;
using Nito.AsyncEx;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.TextTemplating;
using Volo.Abp.TextTemplating.Razor;

namespace Acme.BookStore;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAbpCompiledViewProvider))]
public class MyAbpCompiledViewProvider : IAbpCompiledViewProvider, ITransientDependency
{
    private static readonly ConcurrentDictionary<string, Assembly> CachedAssembles = new ConcurrentDictionary<string, Assembly>();
    private static  readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);

    private readonly AbpCompiledViewProviderOptions _options;
    private readonly AbpRazorTemplateCSharpCompiler _razorTemplateCSharpCompiler;
    private readonly IAbpRazorProjectEngineFactory _razorProjectEngineFactory;
    private readonly ITemplateContentProvider _templateContentProvider;


    public MyAbpCompiledViewProvider(
        IOptions<AbpCompiledViewProviderOptions> options,
        IAbpRazorProjectEngineFactory razorProjectEngineFactory,
        AbpRazorTemplateCSharpCompiler razorTemplateCSharpCompiler,
        ITemplateContentProvider templateContentProvider)
    {
        _options = options.Value;

        _razorProjectEngineFactory = razorProjectEngineFactory;
        _razorTemplateCSharpCompiler = razorTemplateCSharpCompiler;
        _templateContentProvider = templateContentProvider;
    }

    public virtual async Task<Assembly> GetAssemblyAsync(TemplateDefinition templateDefinition)
    {
        async Task<Assembly> CreateAssembly(string content)
        {
            using (var assemblyStream = await GetAssemblyStreamAsync(templateDefinition, content))
            {
                return Assembly.Load(await assemblyStream.GetAllBytesAsync());
            }
        }

        var templateContent = await _templateContentProvider.GetContentOrNullAsync(templateDefinition);
        if (templateContent == null)
        {
            throw new AbpException($"Razor template content of {templateDefinition.Name} is null!");
        }

        using (await _semaphore.LockAsync())
        {
            var cacheKey = (templateDefinition.Name + templateContent).ToMd5();
            if (CachedAssembles.TryGetValue(cacheKey, out var assemble))
            {
                return assemble;
            }

            var newAssemble = await CreateAssembly(templateContent);
            CachedAssembles.TryAdd(cacheKey, newAssemble);
            return newAssemble;
        }
    }

    protected virtual async Task<Stream> GetAssemblyStreamAsync(TemplateDefinition templateDefinition, string templateContent)
    {
        var razorProjectEngine = await _razorProjectEngineFactory.CreateAsync(builder =>
        {
            builder.SetNamespace(AbpRazorTemplateConsts.DefaultNameSpace);
            builder.ConfigureClass((document, node) =>
            {
                node.ClassName = AbpRazorTemplateConsts.DefaultClassName;
            });
        });

        var codeDocument = razorProjectEngine.Process(
            RazorSourceDocument.Create(templateContent, templateDefinition.Name), null,
            new List<RazorSourceDocument>(), new List<TagHelperDescriptor>());

        var cSharpDocument = codeDocument.GetCSharpDocument();

        var templateReferences = _options.TemplateReferences
            .GetOrDefault(templateDefinition.Name)
            ?.Select(x => x)
            .Cast<MetadataReference>()
            .ToList();

        return _razorTemplateCSharpCompiler.CreateAssembly(cSharpDocument.GeneratedCode, templateDefinition.Name, templateReferences);
    }
}

Thanks. I will check it asap.

hi

Please share your test app, Thanks

liming.ma@volosoft.com

hi

We enabled the DynamicXXXStoreEnabled in the ms project by default.

Can you check your template code?

Configure<PermissionManagementOptions>(options =>
{
    options.IsDynamicPermissionStoreEnabled = true;
});

Configure<FeatureManagementOptions>(options =>
{
    options.IsDynamicFeatureStoreEnabled = true;
});

Configure<TextTemplateManagementOptions>(options =>
{
    options.IsDynamicTemplateStoreEnabled = true;
});

Configure<SettingManagementOptions>(options =>
{
    options.IsDynamicSettingStoreEnabled = true;
});
  • Remove Authority Delegation.
  • Disable UI Account management
  • Remove Organization Units feature
  • Hide basically all Settings UI.

These features exist on Account.Pro module and setting-management module

hi

The dashboard will only display the BackgroundJobWorker, It will call your jobs.

hi

https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Proxying/DefaultProxyHttpClientFactory.cs#L6

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-7.0

hi

Can you try to inject the ISettingEncryptionService and Encrypt your default value?

hi

. However, it does not appear on the hangfire dashboard.

Is the job executed?

Currently there is no such design, you can only change the source code.

Showing 6191 to 6200 of 11539 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.