格里芬本地化和流利验证 [英] Griffin localization and Fluent Validation

查看:57
本文介绍了格里芬本地化和流利验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是格里芬本地化的新手,这看起来很酷.但是,示例仅向我展示了如何转换MVC验证属性.

I am new to Griffin localization, it seems very cool. However, examples are only showing me how to translate MVC validation attributes.

如果不是所有的mvc验证属性,我都会使用最小值.我的想法是(尝试)不要在数据层和UI层两次验证和报告消息.我使用Fluent Validation在数据层创建验证器.

I am using minimum if not none of the mvc validation attributes. My idea is (try) not to validate and report messages twice at data layer and UI layer. I create validators at data layer with with Fluent Validation.

您能否给我一个快速的指导(如果存在),如何在数据层将Griffin本地化与Fluent Validation集成在一起?

Could you please give me a quick pointer (if it exists) how we can integrate Griffin Localization with Fluent Validation at data layer?

推荐答案

Griffin.MvcContrib不支持Fluent验证.

Griffin.MvcContrib do not have any support for Fluent Validation.

只是快速浏览了流利的验证,似乎它是从IStringSource提取字符串的.因此,您基本上可以为其创建一个适配器,该适配器从Griffin.MvcContrib资源中读取字符串.

Just took a quick look at fluent validation and it seems like it pulls its string from IStringSource. So you could basically create an adapter for it which reads the strings from the Griffin.MvcContrib resources.

类似的东西:

public class FluentValidationTranslator : IStringSource 
{
    public FluentValidationTranslator(ILocalizedStringProvider griffinProvider)
    {
    }

    // implement the translation here
}

这篇关于格里芬本地化和流利验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆