Skip to content

Instantly share code, notes, and snippets.

@Vaccano
Vaccano / Program.cs
Created June 17, 2022 18:50
Trying to Get Swagger Identity Working
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")).EnableTokenAcquisitionToCallDownstreamApi()
@Vaccano
Vaccano / Program.cs
Last active June 13, 2022 22:42
Attempt to get Azure AD working with Swagger
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")).EnableTokenAcquisitionToCallDownstreamApi()
.AddMicrosoftGraph(builder.Configuration.GetSection("MicrosoftGraph"))
static async void Main(string[] args)
{
Func<Task> startupDone = async () =>
{
await Task.CompletedTask;
};
var taskHere = startupDone.Invoke();
var runTask = DoStuff(() =>
{
@Vaccano
Vaccano / DropLockInstance.sql
Last active February 25, 2020 17:17
Place and Drop Lock Sprocs
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'DropLockInstance')
BEGIN
DROP PROCEDURE locking.DropLockInstance
END
GO
CREATE PROCEDURE locking.DropLockInstance
@lockValue varchar(150),
@scope varchar(50),
@system varchar(50),
@Vaccano
Vaccano / DbContextHelper.cs
Created December 11, 2019 16:34
Call a query with EF Core's DatabaseFacade
public static class DbContextHelper
{
public static List<T> SqlQueryList<T>(this DatabaseFacade database, string query, Func<Dictionary<string, object>, T> conversionFunction, params SqlParameter[] sqlParameters)
{
var conn = database.GetDbConnection();
conn.Open();
var command = conn.CreateCommand();
command.CommandText = query;
command.Parameters.AddRange(sqlParameters);
var reader = command.ExecuteReader();
@Vaccano
Vaccano / package.json
Created April 3, 2017 20:13
Vaccano's webpack setup
{
"license": "MIT",
"devDependencies": {
"@types/whatwg-fetch": "^0.0.33",
"aurelia-tools": "^1.0.0",
"aurelia-webpack-plugin": "^2.0.0-rc.1",
"chai": "^3.5.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^3.2.4",
"css-loader": "^0.27.3",
@Vaccano
Vaccano / app.html
Last active July 19, 2017 21:10
Tab Switching Issue
<template>
<require from="navbar"></require>
<nav-bar router.bind="router"></nav-bar>
<div class="page-host">
<router-view></router-view>
@Vaccano
Vaccano / app.html
Last active July 5, 2017 17:18
Disabled Options
<template>
<h1>${message}</h1>
<select>
<option repeat.for="option of options" model.bind="option">${option.value}</option>
</select>
</template>
@Vaccano
Vaccano / app.html
Created July 5, 2017 17:07
DI inheritance
<template>
<h1>${message}</h1>
</template>
@Vaccano
Vaccano / Full Error
Created June 8, 2017 22:21
Service Fabric Issues
Error event: SourceId='System.FM', Property='State'.
Partition is in quorum loss.
UpgradeOrchestrationService 3 3 00000000-0000-0000-0000-000000006000
S/P RD ClusterNode2 Up 131414258329718880
S/S IB ClusterNode1 Down 131414258623460374
P/S RD ClusterNode3 Down 131414258623460375
(Showing 3 out of 3 replicas. Total available replicas: 1.)