Abp模块
abp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

33 lines
993 B

using Microsoft.Extensions.Localization;
using Sanhe.Abp.Features.LimitValidation.Localization;
using Volo.Abp;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Localization;
namespace Sanhe.Abp.Features.LimitValidation;
public class AbpFeatureLimitException : AbpException, ILocalizeErrorMessage, IBusinessException
{
/// <summary>
/// 功能名称名称
/// </summary>
public string Feature { get; }
/// <summary>
/// 上限
/// </summary>
public int Limit { get; }
public AbpFeatureLimitException(string feature, int limit)
: base($"Features {feature} has exceeded the maximum number of calls {limit}, please apply for the appropriate permission")
{
Feature = feature;
Limit = limit;
}
public string LocalizeMessage(LocalizationContext context)
{
var localizer = context.LocalizerFactory.Create<FeaturesLimitValidationResource>();
return localizer["FeaturesLimitException", Limit];
}
}