Skip to content

MemberAccess do not show custom expression string. #101

Closed
@sdanyliv

Description

@sdanyliv

Well, I have several custom expression types with overridden ToString() and ReadableExpressions shows only property name for some reason.

Simple reproducing sample:

class Program
{
    class TestClass
    {
        public int Id { get; set; }
    }

    class TestExpression : Expression
    {
        private readonly Type _type;

        public TestExpression(Type type)
        {
            _type = type;
        }

        public override string ToString()
        {
            return "Ref(TableContext_1(26)(T: 27))";
        }

        public override Type Type => _type;
        public override ExpressionType NodeType => ExpressionType.Extension;
    }

    public static void Main(string[] args)
    {
        var testExpression = new TestExpression(typeof(TestClass));

        // try to visualize the following:
        var propAccess = Expression.Property(testExpression, "Id");
    }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions