Adding attributes to EntityTypes or Properties in OData metadata
<p>I have a simple WebAPI2 service that uses OData (Microsoft.AspNet.OData v5.9.1, Microsoft.AspNet.WebApi v5.2.3). I get the below metadata document from api/$metadata link.</p>

<pre><code>&lt;edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"&gt;
   &lt;edmx:DataServices&gt;
      &lt;Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Global.Model"&gt;
         &lt;EntityType Name="Account"&gt;
            &lt;Key&gt;
               &lt;PropertyRef Name="Id" /&gt;
            &lt;/Key&gt;
            &lt;Property Name="Id" Type="Edm.String" Nullable="false" /&gt;
            &lt;Property Name="ExtId" Type="Edm.String" /&gt;
            &lt;Property Name="CustomerId" Type="Edm.String" /&gt;
            &lt;Property Name="DivisionId" Type="Edm.String" /&gt;
            &lt;Property Name="Default" Type="Edm.Boolean" Nullable="false" /&gt;
            &lt;Property Name="Status" Type="Edm.Boolean" Nullable="false" /&gt;
            &lt;NavigationProperty Name="Customer" Type="Global.Model.Customer"&gt;
               &lt;ReferentialConstraint Property="CustomerId" ReferencedProperty="Id" /&gt;
            &lt;/NavigationProperty&gt;
         &lt;/EntityType&gt;
      &lt;/Schema&gt;
   &lt;/edmx:DataServices&gt;
&lt;/edmx:Edmx&gt;
</code></pre>

<p>I want to modify this document to return some custom attributes to client. I couldn't find a proper sample or tutorial regarding this question.</p>

<p>My questions are;</p>

<p>1) Is it even possible to modify metadata like below;</p>

<pre><code>     &lt;EntityType Name="Account" CustomAttribute="CustomValue"&gt;
        &lt;Property Name="Id" Type="Edm.String" Nullable="false" MaxLength="3" DisplayName="No" /&gt;
</code></pre>

<p>2) If I create my entities using Entity Framework Database First approach, can I use columns Length, Precision and Scale values to assign attributes?</p>

<p>What I found so far;</p>

<p>1) A closed OData <a href="https://github.com/OData/WebApi/issues/9" rel="nofollow">issue</a>. This question seems to be related to mine, but I can't find SetNamespacePrefixMappings() function or similar anywhere. This function is from Microsoft.Data.Edm but my project has Microsoft.OData.Edm v6.15.0 reference</p>

<p>2) A post about vocabularies on odata.org and a <a href="https://github.com/OData/ODataSamples/tree/master/WebApi/v4/ODataCapabilitiesVocabularySample" rel="nofollow">sample</a>. This may be the answer but I don't know how can I use them. With this sample one can add annotations to metadata but this is limited. Not exactly meet my requirements.</p>