Add TypeContext parameter to ITypeInspector.GetMembers
Following up on previous discussion, this PR adds a TypeContext parameter to ITypeInspector.GetMembers() so that it is easier for custom implementations to handle situations like ignoring computed read-only properties in input types.
Would love to see this upstreamed, if I understand the discussion it spawned from correctly. Right now, code-reuse is made extremely difficult by the inability to reuse output objects as input objects if they contain read-only properties. It seems like an object which works for output should also work for input...
In other words, I would argue that if this code is valid:
public MyObject GetObject() => new MyObject();
Then this code should ALWAYS be valid:
public MyObject GetObject(MyObject obj) => obj;
However, right now that will fail with the class definition:
public class MyObject {
public int Id { get; set; }
public int HashCode => Id;
}
Closing this PR as we now fixed the former mentioned issue with read-only props.