public static TTo Resolve <TFrom, TTo>(this IDynamicTypeResolver typeResolver, object context, params object[] args) where TTo : TFrom { if (typeResolver == null) { throw new ArgumentNullException(nameof(typeResolver)); } return((TTo)typeResolver.Resolve(typeof(TFrom), typeof(TTo), context, args)); }
public static TTo Resolve <TFrom, TTo>(this IDynamicTypeResolver typeResolver) where TTo : TFrom { if (typeResolver == null) { throw new ArgumentNullException(nameof(typeResolver)); } return((TTo)typeResolver.Resolve(typeof(TFrom), typeof(TTo), null, null)); }
public string GetValue() { var defaultLocalization = _typeResolver.Resolve <TLocalization, TDefaultLocalization>(); if (defaultLocalization == null) { throw new InvalidOperationException(); } var format = _propertyExpression == null ? _propertyFunc(defaultLocalization) : (_propertyExpression.Compile())(defaultLocalization); return(_formatProvider == null ? LocalizationServices.Format <TLocalization>(format, _args) : LocalizationServices.Format <TLocalization>(format, _formatProvider, _args)); }