Skip to content
Merged
18 changes: 9 additions & 9 deletions docs/SetupGuide_Dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
- Add 'using System.Collections.Generic;' to the namespaces list at the top of the page.
- Currently, there is an error for the IEnumerable. We'll fix this by creating an Employee class.
- Create a new file and call it 'Employee.cs'
- Paste the below in the file. These are the column names of our SQL table.
- Paste the below in the file. These are the column names of our SQL table. Note that the casing of the Object field names and the table column names must match.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add this note in the other languages docs appropriately.


```csharp
namespace Company.Function {
Expand Down Expand Up @@ -139,7 +139,7 @@ The input binding executes the "select * from Products where Cost = @Cost" query

`Product` is a user-defined POCO that follows the structure of the Products table. It represents a row of the Products table, with field names and types copying those of the Products table schema. For example, if the Products table has three columns of the form

- **ProductID**: int
- **ProductId**: int
- **Name**: varchar
- **Cost**: int

Expand All @@ -148,7 +148,7 @@ Then the `Product` class would look like
```csharp
public class Product
{
public int ProductID { get; set; }
public int ProductId { get; set; }

public string Name { get; set; }

Expand Down Expand Up @@ -361,17 +361,17 @@ public static IActionResult Run(
HttpRequest req,
[Sql("dbo.Products", ConnectionStringSetting = "SqlConnectionString")] out Product[] output)
{
// Suppose that the ProductID column is the primary key in the Products table, and the
// table already contains a row with ProductID = 1. In that case, the row will be updated
// Suppose that the ProductId column is the primary key in the Products table, and the
// table already contains a row with ProductId = 1. In that case, the row will be updated
// instead of inserted to have values Name = "Cup" and Cost = 2.
output = new Product[2];
var product = new Product();
product.ProductID = 1;
product.ProductId = 1;
product.Name = "Cup";
product.Cost = 2;
output[0] = product;
product = new Product();
product.ProductID = 2;
product.ProductId = 2;
product.Name = "Glasses";
product.Cost = 12;
output[1] = product;
Expand All @@ -393,7 +393,7 @@ public static IActionResult Run(
product = new Product
{
Name = req.Query["name"],
ProductID = int.Parse(req.Query["id"]),
ProductId = int.Parse(req.Query["id"]),
Cost = int.Parse(req.Query["cost"])
};
return new CreatedResult($"/api/addproduct", product);
Expand Down Expand Up @@ -432,7 +432,7 @@ public static void Run(
{
Product product = change.Item;
logger.LogInformation($"Change operation: {change.Operation}");
logger.LogInformation($"ProductID: {product.ProductID}, Name: {product.Name}, Cost: {product.Cost}");
logger.LogInformation($"ProductId: {product.ProductId}, Name: {product.Name}, Cost: {product.Cost}");
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/SetupGuide_DotnetOutOfProc.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
- Add 'using System.Collections.Generic;' to the namespaces list at the top of the page.
- Currently, there is an error for the IEnumerable. We'll fix this by creating an Employee class.
- Create a new file and call it 'Employee.cs'
- Paste the below in the file. These are the column names of our SQL table.
- Paste the below in the file. These are the column names of our SQL table. Note that the casing of the Object field names and the table column names must match.

```csharp
namespace Company.Function {
Expand Down Expand Up @@ -127,7 +127,7 @@ The input binding executes the "select * from Products where Cost = @Cost" query

`Product` is a user-defined POCO that follows the structure of the Products table. It represents a row of the Products table, with field names and types copying those of the Products table schema. For example, if the Products table has three columns of the form

- **ProductID**: int
- **ProductId**: int
- **Name**: varchar
- **Cost**: int

Expand All @@ -136,7 +136,7 @@ Then the `Product` class would look like
```csharp
public class Product
{
public int ProductID { get; set; }
public int ProductId { get; set; }

public string Name { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion docs/SetupGuide_Java.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a

- Add 'import com.microsoft.azure.functions.sql.annotation.SQLInput;'
- Create a new file and call it 'Employee.java'
- Paste the below in the file. These are the column names of our SQL table.
- Paste the below in the file. These are the column names of our SQL table. Note that the casing of the Object field names and the table column names must match.

```java
package com.function.Common;
Expand Down
2 changes: 1 addition & 1 deletion docs/SetupGuide_Javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
- Open your app in VS Code
- Press 'F1' and search for 'Azure Functions: Create Function'
- Choose HttpTrigger -> (Provide a function name) -> anonymous
- In the file that opens (`index.js`), replace the `module.exports = async function (context, req)` block with the below code.
- In the file that opens (`index.js`), replace the `module.exports = async function (context, req)` block with the below code. Note that the casing of the Object field names and the table column names must match.

```javascript
module.exports = async function (context, req) {
Expand Down
2 changes: 1 addition & 1 deletion docs/SetupGuide_PowerShell.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
- Open your app in VS Code
- Press 'F1' and search for 'Azure Functions: Create Function'
- Choose HttpTrigger -> (Provide a function name) -> anonymous
- In the file that opens (`run.ps1`), replace the code within the file the below code.
- In the file that opens (`run.ps1`), replace the code within the file the below code. Note that the casing of the Object field names and the table column names must match.

```powershell
using namespace System.Net
Expand Down
2 changes: 1 addition & 1 deletion docs/SetupGuide_Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
- Open your app in VS Code
- Press 'F1' and search for 'Azure Functions: Create Function'
- Choose HttpTrigger -> (Provide a function name) -> anonymous
- In the file that opens (`__init__.py`), replace the `def main(req: func.HttpRequest) -> func.HttpResponse:` block with the below code.
- In the file that opens (`__init__.py`), replace the `def main(req: func.HttpRequest) -> func.HttpResponse:` block with the below code. Note that the casing of the Object field names and the table column names must match.

```python
def main(req: func.HttpRequest, employee: func.Out[func.SqlRow]) -> func.HttpResponse:
Expand Down
6 changes: 3 additions & 3 deletions samples/samples-csharp/Common/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.Azure.WebJobs.Extensions.Sql.Samples.Common
{
public class Product
{
public int ProductID { get; set; }
public int ProductId { get; set; }

public string Name { get; set; }

Expand All @@ -16,15 +16,15 @@ public override bool Equals(object obj)
if (obj is Product)
{
var that = obj as Product;
return this.ProductID == that.ProductID && this.Name == that.Name && this.Cost == that.Cost;
return this.ProductId == that.ProductId && this.Name == that.Name && this.Cost == that.Cost;
}
return false;
}
}

public class ProductWithOptionalId
{
public int? ProductID { get; set; }
public int? ProductId { get; set; }

public string Name { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions samples/samples-csharp/Common/ProductUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static List<Product> GetNewProducts(int num)
{
var product = new Product
{
ProductID = i,
ProductId = i,
Cost = 100 * i,
Name = "test"
};
Expand All @@ -29,7 +29,7 @@ public static List<Product> GetNewProducts(int num)

/// <summary>
/// Returns a list of <paramref name="num"/> Products with a random cost between 1 and <paramref name="cost"/>.
/// Note that ProductID is randomized too so list may not be unique.
/// Note that ProductId is randomized too so list may not be unique.
/// </summary>
public static List<Product> GetNewProductsRandomized(int num, int cost)
{
Expand All @@ -40,7 +40,7 @@ public static List<Product> GetNewProductsRandomized(int num, int cost)
{
var product = new Product
{
ProductID = r.Next(1, num),
ProductId = r.Next(1, num),
Cost = (int)Math.Round(r.NextDouble() * cost),
Name = "test"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static IActionResult Run(
using SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
result += $"ProductID: {reader["ProductID"]}, Name: {reader["Name"]}, Cost: {reader["Cost"]}\n";
result += $"ProductId: {reader["ProductId"]}, Name: {reader["Name"]}, Cost: {reader["Cost"]}\n";
}
}
return new OkObjectResult(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static IActionResult Run(
{
// Products is a JSON representation of the returned rows. For example, if there are two returned rows,
// products could look like:
// [{"ProductID":1,"Name":"Dress","Cost":100},{"ProductID":2,"Name":"Skirt","Cost":100}]
// [{"ProductId":1,"Name":"Dress","Cost":100},{"ProductId":2,"Name":"Skirt","Cost":100}]
return new OkObjectResult(products);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static IActionResult Run(
product = new Product
{
Name = req.Query["name"],
ProductID = int.Parse(req.Query["productId"]),
ProductId = int.Parse(req.Query["productId"]),
Cost = int.Parse(req.Query["cost"])
};
return new CreatedResult($"/api/addproduct", product);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static IActionResult Run(
product = new ProductWithOptionalId
{
Name = req.Query["name"],
ProductID = string.IsNullOrEmpty(req.Query["productId"]) ? null : int.Parse(req.Query["productId"]),
ProductId = string.IsNullOrEmpty(req.Query["productId"]) ? null : int.Parse(req.Query["productId"]),
Cost = int.Parse(req.Query["cost"])
};
return new CreatedResult($"/api/addproductwithidentitycolumnincluded", product);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@

package com.function.Common;

import com.fasterxml.jackson.annotation.JsonProperty;

public class Product {
@JsonProperty("ProductId")
private int ProductId;
@JsonProperty("Name")
private String Name;
@JsonProperty("Cost")
private int Cost;

public Product() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@

package com.function.Common;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ProductWithDefaultPK {
@JsonProperty("Name")
private String Name;
@JsonProperty("Cost")
private int Cost;

public ProductWithDefaultPK() {
Expand Down
6 changes: 3 additions & 3 deletions samples/samples-js/AddProductParams/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');

const newProduct = {
"productId": req.query?.productId,
"name": req.query?.name,
"cost": req.query?.cost
"ProductId": req.query?.productId,
"Name": req.query?.name,
"Cost": req.query?.cost
};

context.bindings.product = JSON.stringify(newProduct);
Expand Down
4 changes: 2 additions & 2 deletions samples/samples-js/AddProductWithIdentityColumn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');

const itemToInsert = {
"name": req.query?.name,
"cost": req.query?.cost
"Name": req.query?.name,
"Cost": req.query?.cost
};
context.bindings.product = JSON.stringify(itemToInsert);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');

const itemToInsert = {
"productId" : req.query?.productId,
"name": req.query?.name,
"cost": req.query?.cost
"ProductId" : req.query?.productId,
"Name": req.query?.name,
"Cost": req.query?.cost
};

context.bindings.product = JSON.stringify(itemToInsert);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');

const testProduct = {
"externalId": req.query?.externalId,
"name": req.query?.name,
"cost": req.query?.cost
"ExternalId": req.query?.externalId,
"Name": req.query?.name,
"Cost": req.query?.cost
};

context.bindings.product = JSON.stringify(testProduct);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
/// ID will be generated upon insert.
module.exports = async function (context, req) {
let products = [{
name: "Cup",
cost: "2"
Name: "Cup",
Cost: "2"
}, {
name: "Glasses",
cost: "12"
Name: "Glasses",
Cost: "12"
}]
context.bindings.products = products;

Expand Down
6 changes: 3 additions & 3 deletions samples/samples-js/QueueTriggerProducts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = async function (context, queueMessage) {
let products = [];
for (let i = 0; i < totalUpserts; i++) {
products.push({
productId: i,
name: "test",
cost: 100 * i
ProductId: i,
Name: "test",
Cost: 100 * i
});
}
context.bindings.products = products;
Expand Down
6 changes: 3 additions & 3 deletions samples/samples-js/TimerTriggerProducts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module.exports = async function (context) {
let products = [];
for (let i = 0; i < totalUpserts; i++) {
products.push({
productId: i,
name: "test",
cost: 100 * i
ProductId: i,
Name: "test",
Cost: 100 * i
});
}
const duration = Date.now() - start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static string Run(
{
// Products is a JSON representation of the returned rows. For example, if there are two returned rows,
// products could look like:
// [{"ProductID":1,"Name":"Dress","Cost":100},{"ProductID":2,"Name":"Skirt","Cost":100}]
// [{"ProductId":1,"Name":"Dress","Cost":100},{"ProductId":2,"Name":"Skirt","Cost":100}]
return products;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static Product Run(
var product = new Product()
{
Name = queryStrings["name"],
ProductID = int.Parse(queryStrings["productId"], null),
ProductId = int.Parse(queryStrings["productId"], null),
Cost = int.Parse(queryStrings["cost"], null)
};
return product;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static ProductWithOptionalId Run(
var product = new ProductWithOptionalId
{
Name = queryStrings["name"],
ProductID = string.IsNullOrEmpty(queryStrings["productId"]) ? null : int.Parse(queryStrings["productId"], null),
ProductId = string.IsNullOrEmpty(queryStrings["productId"]) ? null : int.Parse(queryStrings["productId"], null),
Cost = int.Parse(queryStrings["cost"], null)
};
return product;
Expand Down
Loading