public string GetHeaderNameByExpression <TDto>(Expression <Func <TDto, object> > expression) where TDto : class { string propertyName = TypePropertiesNameResolver.GetMemberName(expression); var propertyInfo = typeof(TDto).GetProperties().FirstOrDefault(x => x.Name.Equals(propertyName)); return(GetHeaderNameByProperty(propertyInfo)); }
public MetricPreciseValidationBuilder AssertMetric(Expression <Func <Root, object> > expression) { string metricName = TypePropertiesNameResolver.GetMemberName(expression); Func <Root, object> compiledExpression = expression.Compile(); dynamic actualValue = compiledExpression(PerformanceReport.Value); return(new MetricPreciseValidationBuilder(actualValue, metricName)); }
public static string GetUrl <TUrlSettings>(Expression <Func <TUrlSettings, object> > expression, string partialUrl = "") where TUrlSettings : class, new() { string propertyName = TypePropertiesNameResolver.GetMemberName(expression); var urlSettings = ConfigurationService.GetSection <TUrlSettings>(); var propertyInfo = typeof(TUrlSettings).GetProperties().FirstOrDefault(x => x.Name.Equals(propertyName)); return(new Uri(new Uri(propertyInfo.GetValue(urlSettings) as string), partialUrl).AbsoluteUri); }