DTO and complex type properties

Does the metadata or types services hold the relationship between types anywhere?

public class MyRequest : IReturn<MyResponse> {
  public MyType Complex { get; set; }
}

public class MyType {
 public string Foo { get; set; }
}

public class MyResponse {
 public string Bar { get; set; }
}

Rationale is that we want to be able to filter all types at a request/s level and we need to recursively include responses and complex sub types… and we’re lazy! :wink:

The relationship is held in that each DTO has properties which contains the Type and Namespace of each of its properties.

But we also have an extension method that should do what you need:

var referencedTypes = typeof(MyRequest).GetReferencedTypes();
1 Like

That’ll do nicely, thanks.