Versioning in Web API 2
<p>Had a quick question regarding versioning in Web Api 2.0.</p>
<p>I've developed an entirely RESTful API, however I have 2 controllers of the same name.</p>
<p>I've put them in diff namespaces according to separate folders.
(E.g. v1 and v2 folders).</p>
<p><a href="https://i.stack.imgur.com/lCdAp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lCdAp.png" alt="enter image description here" /></a></p>
<p>I've also configured the correct routing using the normal NamespaceHttpControllerSelector.
So up until now everything is working correctly.</p>
<p>I had a question however...is it possible to <em>still have versioning</em> for the Emails controller <em>even if I put</em>  EmailsController on the Root level?</p>
<p>E.g.</p>
<blockquote>
<p>Controllers/v1/EmailControllers</p>
<p>Controllers/EmailsControllers</p>
</blockquote>
<p>Would this still be possible?</p>
<p>Edit:</p>
<p>I forgot to mention that I have not used the <code>RoutePrefix</code> attribute because I kept on receiving errors on my <code>RouteConstraint</code>.</p>
<p>I've decorated my action methods with the following (which seems a bit redundant because they essentially have the same Namespace):</p>
<p><code>[Route(&quot;api/{apiVersion1:ApiVersion1Constraint(v1)}/emails/LogEmails&quot;, Name = &quot;LogEmailsRoute_1&quot;)]</code></p>