I read in the Microsoft.AspNet.Scaffolding.Core.Metadata namespace; however, I'm new to this object model, and maybe I'm missing something. I am creating T4 text templates and would like to automatically generate output for the associated model data. Something similar to ModelMetadata.RelatedModelMetadata.ModelMetadata.PropertyMetadata ie
foreach (PropertyMetadata property in ModelMetadata.Properties) {
if (property.IsAssociation) {
RelatedModelMetadata relatedModel = property.RelatedModel
foreach (PropertyMetadata relatedProperty in relatedModel.Properties) {
}
}
}
This, of course, will not work, since the RelatedModelMetadata object does not have a collection of properties; in fact, all relatedModelMetadata properties are strings.
Any hints are tricks that you might appreciate.
Thank!
source
share