Beispiel #1
0
        protected override Expression VisitMember(MemberExpression node)
        {
            if (!AttributesHelper.IsAttributesClass(node.Member.DeclaringType))
            {
                throw new NotSupportedException();
            }

            var attributeName = node.ToString();

            if (!_attributes.ContainsKey(attributeName))
            {
                throw new AttributeMissingException(attributeName);
            }

            return(Expression.Constant(_attributes[attributeName]));
        }