Creating DynamicObject and providing metadata
Sometimes, you don’t have the luxury of having your types represented in code. This could be if you’re calling an external API of some sort, be it a REST API, SOAP service, or similar. However, the third party you’re calling might have a representation of the type in a standard format, such as a WSDL or JSON schema.
Even though dynamic objects can be very flexible, in the real world the shape of data tends to be stricter. So, instead of using ExpandoObject for everything, you could represent these types with a custom dynamic object that gets its metadata from a well-known format. It’s very common today to use JSON as a data carrier, and it’s also common to represent the shape of data by leveraging JSON schemas. Let’s look at how that could be a provider of metadata.
Building a JSON schema type
Start by creating a folder called Chapter9. Change into this folder in your command-line interface...