public Expression Build(ParameterInfo parameter, Expression context) { GlobalStateAttribute attribute = parameter.GetCustomAttribute <GlobalStateAttribute>() !; ConstantExpression key = attribute.Key is null ? Expression.Constant(parameter.Name, typeof(string)) : Expression.Constant(attribute.Key, typeof(string)); MemberExpression contextData = Expression.Property(context, _contextData); return(IsStateSetter(parameter.ParameterType) ? BuildSetter(parameter, key, contextData) : BuildGetter(parameter, key, contextData)); }
public override Expression Compile( Expression context, ParameterInfo parameter, Type sourceType) { GlobalStateAttribute attribute = parameter.GetCustomAttribute <GlobalStateAttribute>(); ConstantExpression key = attribute.Key is null ? Expression.Constant(parameter.Name, typeof(string)) : Expression.Constant(attribute.Key, typeof(string)); MemberExpression contextData = Expression.Property(context, ContextData); return(Compile(parameter, key, contextData)); }