-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean csx samples #812
Merged
Merged
Clean csx samples #812
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
282053c
sql attribute not needed
MaddyDev 5397606
simplify the folder structure for csx
MaddyDev 6d99129
add local.settings.json
MaddyDev c6344ec
Merge branch 'main' into maddy/cleanCsxSamples
MaddyDev eea2ee8
Merge branch 'main' into maddy/cleanCsxSamples
MaddyDev e7305fa
rename folders in proj file
MaddyDev 4d5bff6
clean up logs and unused
MaddyDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"name": "req", | ||
"direction": "in", | ||
"type": "httpTrigger", | ||
"methods": [ | ||
"post" | ||
], | ||
"route": "addproduct" | ||
}, | ||
{ | ||
"name": "$return", | ||
"type": "http", | ||
"direction": "out" | ||
}, | ||
{ | ||
"name": "product", | ||
"type": "sql", | ||
"direction": "out", | ||
"commandText": "[dbo].[Products]", | ||
"commandType": "Text", | ||
"connectionStringSetting": "SqlConnectionString" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
#load "../Common/product.csx" | ||
#r "Newtonsoft.Json" | ||
|
||
using System.Net; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Primitives; | ||
using Newtonsoft.Json; | ||
|
||
public static Product Run(HttpRequest req, ILogger log, out Product product) | ||
{ | ||
log.LogInformation("C# HTTP trigger function processed a request."); | ||
|
||
|
||
string requestBody = new StreamReader(req.Body).ReadToEnd(); | ||
product = JsonConvert.DeserializeObject<Product>(requestBody); | ||
|
||
string responseMessage = string.IsNullOrEmpty(product.Name) | ||
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." | ||
: $"Hello, {product.Name}. This HTTP triggered function executed successfully."; | ||
|
||
return product; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"name": "req", | ||
"direction": "in", | ||
"type": "httpTrigger", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": "addproduct-params" | ||
}, | ||
{ | ||
"name": "$return", | ||
"type": "http", | ||
"direction": "out" | ||
}, | ||
{ | ||
"name": "product", | ||
"type": "sql", | ||
"direction": "out", | ||
"commandText": "[dbo].[Products]", | ||
"connectionStringSetting": "SqlConnectionString" | ||
} | ||
], | ||
"disabled": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
#load "../Common/product.csx" | ||
#r "Newtonsoft.Json" | ||
|
||
using System.Net; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Primitives; | ||
using Newtonsoft.Json; | ||
|
||
public static Product Run(HttpRequest req, ILogger log, out Product product) | ||
{ | ||
log.LogInformation("C# HTTP trigger function processed a request."); | ||
|
||
product = new Product | ||
{ | ||
Name = req.Query["name"], | ||
ProductId = int.Parse(req.Query["productId"]), | ||
Cost = int.Parse(req.Query["cost"]) | ||
}; | ||
|
||
string responseMessage = string.IsNullOrEmpty(product.Name) | ||
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." | ||
: $"Hello, {product.Name}. This HTTP triggered function executed successfully."; | ||
|
||
return product; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"name": "req", | ||
"direction": "in", | ||
"type": "httpTrigger", | ||
"methods": [ | ||
"post" | ||
], | ||
"route": "addproductwithdefaultpk" | ||
}, | ||
{ | ||
"name": "$return", | ||
"type": "http", | ||
"direction": "out" | ||
}, | ||
{ | ||
"name": "product", | ||
"type": "sql", | ||
"direction": "out", | ||
"commandText": "[dbo].[ProductsWithDefaultPK]", | ||
"connectionStringSetting": "SqlConnectionString" | ||
} | ||
], | ||
"disabled": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
#load "../Common/product.csx" | ||
#r "Newtonsoft.Json" | ||
|
||
using System.Net; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Primitives; | ||
using Newtonsoft.Json; | ||
|
||
public static ProductWithDefaultPK Run(HttpRequest req, ILogger log, out ProductWithDefaultPK product) | ||
{ | ||
log.LogInformation("C# HTTP trigger function processed a request."); | ||
|
||
|
||
string requestBody = new StreamReader(req.Body).ReadToEnd(); | ||
product = JsonConvert.DeserializeObject<ProductWithDefaultPK>(requestBody); | ||
|
||
string responseMessage = string.IsNullOrEmpty(product.Name) | ||
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." | ||
: $"Hello, {product.Name}. This HTTP triggered function executed successfully."; | ||
|
||
return product; | ||
} |
27 changes: 27 additions & 0 deletions
27
samples/samples-csx/AddProductWithIdentityColumn/function.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"name": "req", | ||
"direction": "in", | ||
"type": "httpTrigger", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": "addproductwithidentitycolumn" | ||
}, | ||
{ | ||
"name": "$return", | ||
"type": "http", | ||
"direction": "out" | ||
}, | ||
{ | ||
"name": "product", | ||
"type": "sql", | ||
"direction": "out", | ||
"commandText": "[dbo].[ProductsWithIdentity]", | ||
"connectionStringSetting": "SqlConnectionString" | ||
} | ||
], | ||
"disabled": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
#load "../Common/product.csx" | ||
#r "Newtonsoft.Json" | ||
|
||
using System.Net; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Primitives; | ||
using Newtonsoft.Json; | ||
|
||
public static ProductWithoutId Run(HttpRequest req, ILogger log, out ProductWithoutId product) | ||
{ | ||
log.LogInformation("C# HTTP trigger function processed a request."); | ||
|
||
product = new ProductWithoutId | ||
{ | ||
Name = req.Query["name"], | ||
Cost = int.Parse(req.Query["cost"]) | ||
}; | ||
|
||
string responseMessage = string.IsNullOrEmpty(product.Name) | ||
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." | ||
: $"Hello, {product.Name}. This HTTP triggered function executed successfully."; | ||
|
||
return product; | ||
} |
27 changes: 27 additions & 0 deletions
27
samples/samples-csx/AddProductWithIdentityColumnIncluded/function.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"name": "req", | ||
"direction": "in", | ||
"type": "httpTrigger", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": "addproductwithidentitycolumnincluded" | ||
}, | ||
{ | ||
"name": "$return", | ||
"type": "http", | ||
"direction": "out" | ||
}, | ||
{ | ||
"name": "product", | ||
"type": "sql", | ||
"direction": "out", | ||
"commandText": "[dbo].[ProductsWithIdentity]", | ||
"connectionStringSetting": "SqlConnectionString" | ||
} | ||
], | ||
"disabled": false | ||
} |
28 changes: 28 additions & 0 deletions
28
samples/samples-csx/AddProductWithIdentityColumnIncluded/run.csx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
#load "../Common/product.csx" | ||
#r "Newtonsoft.Json" | ||
|
||
using System.Net; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Primitives; | ||
using Newtonsoft.Json; | ||
|
||
public static ProductWithOptionalId Run(HttpRequest req, ILogger log, out ProductWithOptionalId product) | ||
{ | ||
log.LogInformation("C# HTTP trigger function processed a request."); | ||
|
||
product = product = new ProductWithOptionalId | ||
{ | ||
Name = req.Query["name"], | ||
ProductId = string.IsNullOrEmpty(req.Query["productId"]) ? (int?)null : int.Parse(req.Query["productId"]), | ||
Cost = int.Parse(req.Query["cost"]) | ||
}; | ||
|
||
string responseMessage = string.IsNullOrEmpty(product.Name) | ||
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." | ||
: $"Hello, {product.Name}. This HTTP triggered function executed successfully."; | ||
|
||
return product; | ||
} |
27 changes: 27 additions & 0 deletions
27
samples/samples-csx/AddProductWithMultiplePrimaryColumnsAndIdentity/function.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"name": "req", | ||
"direction": "in", | ||
"type": "httpTrigger", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": "addproductwithmultipleprimarycolumnsandidentity" | ||
}, | ||
{ | ||
"name": "$return", | ||
"type": "http", | ||
"direction": "out" | ||
}, | ||
{ | ||
"name": "product", | ||
"type": "sql", | ||
"direction": "out", | ||
"commandText": "[dbo].[ProductsWithMultiplePrimaryColumnsAndIdentity]", | ||
"connectionStringSetting": "SqlConnectionString" | ||
} | ||
], | ||
"disabled": false | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this, it's not even used (same for all the other samples)