GetFullMemberName() static private method

static private GetFullMemberName ( Expression memberSelector ) : string
memberSelector Expression
return string
        public static MvcHtmlString TranslateByCulture(this HtmlHelper helper, Expression <Func <object> > model, Type customAttribute, CultureInfo culture, params object[] formatArguments)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (customAttribute == null)
            {
                throw new ArgumentNullException(nameof(customAttribute));
            }

            if (culture == null)
            {
                throw new ArgumentNullException(nameof(culture));
            }

            if (!typeof(Attribute).IsAssignableFrom(customAttribute))
            {
                throw new ArgumentException($"Given type `{customAttribute.FullName}` is not of type `System.Attribute`");
            }

            var resourceKey = ResourceKeyBuilder.BuildResourceKey(ExpressionHelper.GetFullMemberName(model), customAttribute);

            return(new MvcHtmlString(LocalizationProvider.Current.GetStringByCulture(resourceKey, culture, formatArguments)));
        }
Beispiel #2
0
        public static MvcHtmlString GetTranslations(this HtmlHelper helper, Expression <Func <object> > model, string language = null, string alias = null, bool debug = false, bool camelCase = false)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            return(GenerateScriptTag(language, alias, debug, ExpressionHelper.GetFullMemberName(model), camelCase));
        }
 public static MvcHtmlString TranslateForByCulture <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, CultureInfo culture, params object[] formatArguments)
 {
     return(new MvcHtmlString(LocalizationProvider.Current.GetStringByCulture(ExpressionHelper.GetFullMemberName(expression), culture, formatArguments)));
 }