test-outofproc/AddProductDefaultPKAndDifferentColumnOrder.cs (22 lines of code) (raw):
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Extensions.Sql;
using DotnetIsolatedTests.Common;
using Microsoft.AspNetCore.Http;
namespace DotnetIsolatedTests
{
public static class AddProductDefaultPKAndDifferentColumnOrder
{
/// <summary>
/// This shows an example of a SQL Output binding where the target table has a default primary key
/// of type uniqueidentifier and the column is not included in the output object. The order of the
/// properties in the POCO is different from the order of the columns in the SQL table. A new row will
/// be inserted and the uniqueidentifier will be generated by the engine.
/// </summary>
[Function("AddProductDefaultPKAndDifferentColumnOrder")]
[SqlOutput("dbo.ProductsWithDefaultPK", "SqlConnectionString")]
public static ProductDefaultPKWithDifferentColumnOrder Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "addproductdefaultpkanddifferentcolumnorder")] HttpRequest req)
{
var product = new ProductDefaultPKWithDifferentColumnOrder()
{
Cost = 100,
Name = "test"
};
return product;
}
}
}