0
fadijb created
- ABP Framework version: v 7.1.1
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC): no
- Exception message and stack trace: An unhandled exception occurred while processing the request. InvalidOperationException: The resource type 'Horizon.HRMS1.Localization.HRMS1Resource' does not have an accessible static property named 'MobileNoFormat'. System.ComponentModel.DataAnnotations.ValidationAttribute.SetResourceAccessorByPropertyLookup()
TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MethodInvoker.Invoke(object obj, IntPtr* args, BindingFlags invokeAttr)
1 Answer(s)
-
0
Hi, you can change the resource by configuring
AbpMvcDataAnnotationsLocalizationOptions
in the first step I specified below:1-) AddAssemblyResource
[DependsOn( //modules... )] public class MyWebModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => { options.AddAssemblyResource(typeof(MyResource), typeof(MyWebModule).Assembly); }); } }
2-) Usage with
RegularExpression
attribute.[RegularExpression(@"^966.*", ErrorMessage="MobileNoFormat")]