Metadata inspection
The OData metadata is exposed via the FuseIT.S4D.DynamicsConnector.Metadata.CsdlMetadata class.
var session = serviceFactory.GetSessionFromConnectionString("MyDynamicsInstance");
// Get metadata from session.
var metadata = await session.GetMetadata();
// List all available entities.
IEnumerable<string> entities = metadata.GetAllEntities();
// List fields for an entity.
IEnumerable<string> entityFields = metadata.GetEntityFieldNames("lead");
// Get the key fields for an entity (in this case, ["leadid"]).
IEnumerable<string> entityKeyFields = metadata.GetEntityKeys("lead");
Provided that local metadata file caching is working correctly, metadata does not incur any API calls after the first file retrieval.