This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$packageName = Get-VstsInput -Name 'packageName' -Require | |
$maxIncrement = Get-VstsInput -Name 'maxIncrement' -Require | |
$pipelineVariable = Get-VstsInput -Name 'pipelineVariable' -Require | |
Write-Host "The Package in use is: " $packageName | |
Write-Host "The Max Increment version is: " $maxIncrement | |
#Add Package Source | |
Write-Host "Adding Nuget Package Source" | |
Register-PackageSource -Name NuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ASP.NET Core (.NET Framework) | |
# Build and test ASP.NET Core projects targeting the full .NET Framework. | |
# Add steps that publish symbols, save build artifacts, and more: | |
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core | |
trigger: | |
- dev | |
pool: | |
vmImage: 'Ubuntu-16.04' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace HomeController | |
{ | |
[ApiVersion("1.0", Deprecated = true)] | |
[Route("api/Values")] | |
public class HomeController : Controller | |
{ | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "Value1 from Version 1", "value2 from Version 1" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace HomeController | |
{ | |
[ApiVersion("1.0")] | |
[Route("api/Values")] | |
public class HomeController : Controller | |
{ | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "Value1 from Version 1", "value2 from Version 1" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiVersionNeutral] | |
[RoutePrefix( "api/[controller]" )] | |
public class PingController : Controller { | |
return Ok(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("api/{v:apiVersion}/Values")] | |
public class HomeController : Controller | |
{ | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "Value1 from Version 2", "value2 from Version 2" }; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace HomeController | |
{ | |
[ApiVersion("1.0")] | |
[Route("api/Values")] | |
public class HomeController : Controller | |
{ | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "Value1 from Version 1", "value2 from Version 1" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddApiVersioning(options => | |
{ | |
options.ReportApiVersions = true; | |
options.DefaultApiVersion = new ApiVersion(1, 0); | |
options.AssumeDefaultVersionWhenUnspecified = true; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var context = new OrderingDbContext()) | |
{ | |
// Load all Orders and related Line Items | |
var orders = context.Order | |
.Include(b => b.LineItem) | |
.ToList(); | |
// Load an Order and it's related Line Items | |
var orders = context.Order | |
.Where(x => x.OrderId == orderId) |