コード例 #1
0
        public static IRuleBuilderOptions <T, TProperty> WithLocalizedMessage <T, TProperty>(this IRuleBuilderOptions <T, TProperty> rule, Expression <Func <string> > resourceSelector, params Func <T, object>[] formatArgs)
        {
            // We use the StaticResourceAccessorBuilder here because we don't want calls to WithLocalizedMessage to be overriden by the ResourceProviderType.
            return(rule.Configure(config => {
                var funcs = formatArgs
                            .Select(func => new Func <object, object, object>((instance, value) => func((T)instance))).ToList();

                config.CurrentValidator.ErrorMessageSource = new BackwardsCompatFormatArgStringSource(LocalizedStringSource.CreateFromExpression(resourceSelector, null), funcs);;
            }));
        }
コード例 #2
0
 protected PropertyValidator(Expression <Func <string> > errorMessageResourceSelector)
 {
     originalErrorSource = errorSource = LocalizedStringSource.CreateFromExpression(errorMessageResourceSelector, new FallbackAwareResourceAccessorBuilder());
 }
コード例 #3
0
ファイル: CR2WFile.cs プロジェクト: dragnilar/WolvenKit-DX
 public string GetLocalizedString(uint val)
 {
     return(LocalizedStringSource != null?LocalizedStringSource.GetLocalizedString(val) : null);
 }