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
2020-05-01T19:06:05.0948538Z ##[error]Publishing to database '****' on server '***.database.windows.net,1433'. | |
Initializing deployment (Start) | |
Initializing deployment (Failed) | |
Time elapsed 00:00:06.91 | |
*** An error occurred during deployment plan generation. Deployment cannot continue. The Element class SqlColumnStoreIndex does not contain the Relationship class OrderedColumns. |
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
$Fields = @{ | |
grant_type = "client_credentials" | |
client_id = "<service-principal-id>" | |
resource = "<resource-id-to-auth-for-or-url>" | |
client_secret = "<service-principal-secret>" | |
}; | |
$response = Invoke-RestMethod ` | |
-Uri "https://login.microsoftonline.com/<azure-tenant-id>/oauth2/token" ` | |
-ContentType "application/x-www-form-urlencoded" ` | |
-Method POST ` |
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
public override void Configure(IFunctionsHostBuilder builder) | |
{ | |
... | |
builder.Services.AddLogging(); | |
//workaround azure functions not handling nested arrays by default | |
builder.Services.AddTransient<IConfigureOptions<MvcOptions>, MvcJsonMvcOptionsSetup>(); | |
builder.Services.AddTransient<BaseValidator<Widget>, WidgetValidator>(o => new WidgetValidator()); | |
builder.Services.AddTransient<BaseValidator<User>, UserValidator>(o => new UserValidator()); |
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
public class KeyResults | |
{ | |
private readonly WidgetDbContext _dbContext; | |
private readonly FunctionWrapper<Widget> _functionWrapper; | |
public Widgets(WidgetDbContext dbContext, FunctionWrapper<Widget> functionWrapper) | |
{ | |
_dbContext = dbContext; | |
_functionWrapper = functionWrapper; | |
} |
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 System.Net; | |
using Microsoft.AspNetCore.Mvc; | |
namespace WidgetApi.Models | |
{ | |
internal class ResponseEnvelopeResult<T> : ObjectResult where T : class | |
{ | |
/// <summary> | |
/// Data envelope for wrapping responses | |
/// </summary> |
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 System; | |
using System.Linq; | |
using System.Net; | |
using System.Threading.Tasks; | |
using FluentValidation; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.EntityFrameworkCore.Internal; | |
using Microsoft.Extensions.Logging; | |
using WidgetApi.Models; |
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 System.Net.Http; | |
using FluentValidation; | |
using WidgetApi.Models; | |
namespace WidgetApi.FunctionHelpers | |
{ | |
public class BaseValidator<T> : AbstractValidator<T> where T : ModelBase | |
{ | |
public BaseValidator() | |
{ |
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 System; | |
namespace WidgetApi.Models | |
{ | |
public abstract class ModelBase | |
{ | |
public int Id { get; set; } | |
public int CreatedBy { get; set; } | |
public DateTime CreatedOn { get; set; } | |
public int? UpdatedBy { get; set; } |
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
public async Task<IActionResult> PostWidget( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "widgets")] Models.Widget item, ILogger log) | |
{ | |
log.LogInformation($"posting widget: ${item.Id}"); | |
var newItem = await _dbContext.Widgets.AddAsync(item); | |
await _dbContext.SaveChangesAsync(); | |
return new OkObjectResult(newItem.Entity); | |
} |
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
public class Widgets | |
{ | |
private readonly DbContext _DbContext; | |
private readonly FunctionWrapper _functionWrapper; | |
public Widgets(DbContext DbContext, FunctionWrapper functionWrapper) | |
{ | |
_DbContext = DbContext; | |
_functionWrapper = functionWrapper; | |
} |