Proposal to create a strongly typed standard vocabulary API as a new separate nuget package.
today the standard vocabulary is exposed through types like
Microsoft.OData.Edm.Vocabularies.V1.CapabilitiesVocabularyModel and Microsoft.OData.Edm.Vocabularies.V1.CoreVocabularyModel. But the coverage is sparse; a lot of terms from Core are exposed via C# properties but for Vocabulary only the IEdmModel is provided as a property.
There should be an API that allows to read and write Annotation using strongly typed C# classes. Something along the lines of
model.AddAnnotation(element, new V1.Capabilities.ReadRestrictions{ … } );
and
model.TryGetAnnotation<V1.Capabilities.ReadRestrictions>(element, out var annotation);
or at least through a more generic object model similar to the API's provided by the System.Text.Json.JsonElement or Newtonsoft.Json.Linq.JObject.
The code for that needs to be able to map from IEdmExpression to C# classes (and vice versa) . Such code is very repetitive for different annotation and error prone but completely defined by the CSDL schema for the annotation vocabulary.
That means there is an opportunity to generate this code automatically from the vocabulary CSDL files.
Proposal to create a strongly typed standard vocabulary API as a new separate nuget package.
today the standard vocabulary is exposed through types like
Microsoft.OData.Edm.Vocabularies.V1.CapabilitiesVocabularyModelandMicrosoft.OData.Edm.Vocabularies.V1.CoreVocabularyModel. But the coverage is sparse; a lot of terms from Core are exposed via C# properties but for Vocabulary only the IEdmModel is provided as a property.There should be an API that allows to read and write Annotation using strongly typed C# classes. Something along the lines of
and
or at least through a more generic object model similar to the API's provided by the System.Text.Json.JsonElement or Newtonsoft.Json.Linq.JObject.
The code for that needs to be able to map from IEdmExpression to C# classes (and vice versa) . Such code is very repetitive for different annotation and error prone but completely defined by the CSDL schema for the annotation vocabulary.
That means there is an opportunity to generate this code automatically from the vocabulary CSDL files.