I have versioned DTOs (for better or worse) like this:
[Route("/v1/login", Verbs = "POST")]
[Route("/v2/login", Verbs = "POST")]
[DataContract]
public class Login : IReturn<LoginResponse>
{
[DataMember( IsRequired = true)]
public string Username { get; set; }
[DataMember( IsRequired = true)]
public string Password { get; set; }
[DataMember( IsRequired = false)]
public string Key{ get; set; }//added for v2
}
My issue is that when consuming the api via .net client, I cant seem to figure out how to specify which version of the route to use (other than modifying the base url when initializing the jsonclient, which does not work in all our use cases). Its as though the DTO defaults to 1 route, even when there are more route options available.
Other than manually specifying the "v2" route during the post, is there a better way to accomplish this default route behavior?