Skip to content

Instantly share code, notes, and snippets.

@GeradeDev
Created August 28, 2019 07:36
Show Gist options
  • Save GeradeDev/983293f6edd47384cd63641f95b337a4 to your computer and use it in GitHub Desktop.
Save GeradeDev/983293f6edd47384cd63641f95b337a4 to your computer and use it in GitHub Desktop.
services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
options.DefaultApiVersion = new ApiVersion(1, 0);
options.AssumeDefaultVersionWhenUnspecified = true;
//Add Conventions
options.Conventions.Controller<HomeController>().HasApiVersion(new ApiVersion(1, 0));
options.Conventions.Controller<HomeV2Controller>().HasApiVersion(new ApiVersion(2, 0));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment