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 HttpLoggingHandler : DelegatingHandler | |
{ | |
public HttpLoggingHandler(HttpMessageHandler innerHandler = null) | |
: base(innerHandler ?? new HttpClientHandler()) | |
{ } | |
async protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
var req = request; | |
var id = Guid.NewGuid().ToString(); | |
var msg = $"[{id} - Request]"; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
For more information on how to configure your ASP.NET application, please visit | |
https://go.microsoft.com/fwlink/?LinkId=301880 | |
--> | |
<configuration> | |
<appSettings> | |
<add key="ida:ClientId" value="f22b1f74-9333-4f96-a5e3-5a175120c6c6" /> | |
<add key="ida:AADInstance" value="https://login.microsoftonline.com/" /> |
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.Collections.Generic; | |
using System.Configuration; | |
using System.Globalization; | |
using System.Threading.Tasks; | |
using System.Linq; | |
using System.Web; | |
using Microsoft.Owin.Extensions; | |
using Microsoft.Owin.Security; | |
using Microsoft.Owin.Security.Cookies; |
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
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" require-expiration-time="false" require-scheme="Bearer" require-signed-tokens="false"> | |
<openid-config url="https://login.microsoftonline.com/{Tenant Id}/v2.0/.well-known/openid-configuration" /> | |
<issuers> | |
<issuer>https://sts.windows.net/{Tenant Id}/</issuer> | |
</issuers> | |
<required-claims> | |
<claim name="aud" match="all"> | |
<value>{Backend application id}</value> | |
</claim> | |
</required-claims> |
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
foreach(var property in item.GetType().GetProperties()) | |
{ | |
if(property.PropertyType.FullName == "System.String") | |
{ | |
if(property.GetValue(item) == null) | |
property.SetValue(item, string.Empty); | |
} | |
} |
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 .gitignore file should be placed at the root of your Unity project directory | |
# | |
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore | |
# | |
/[Ll]ibrary/ | |
/[Tt]emp/ | |
/[Oo]bj/ | |
/[Bb]uild/ | |
/[Bb]uilds/ | |
/[Ll]ogs/ |
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 source https://github.com/Azure/Azure-Functions/issues/717#issuecomment-400098791*/ | |
public static string GetSqlConnectionString(string name) | |
{ | |
string conStr = System.Environment.GetEnvironmentVariable($"ConnectionStrings:{name}", EnvironmentVariableTarget.Process); | |
if (string.IsNullOrEmpty(conStr)) // Azure Functions App Service naming convention | |
conStr = System.Environment.GetEnvironmentVariable($"SQLCONNSTR_{name}", EnvironmentVariableTarget.Process); | |
return conStr; | |
} | |
public static string GetSqlAzureConnectionString(string name) |
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
var newFile = @"newbook.core.xlsx"; | |
using (var fs = new FileStream(newFile, FileMode.Create, FileAccess.Write)) { | |
IWorkbook workbook = new XSSFWorkbook(); | |
ISheet sheet1 = workbook.CreateSheet("Sheet1"); | |
sheet1.AddMergedRegion(new CellRangeAddress(0, 0, 0, 10)); | |
var rowIndex = 0; |
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
var mapper = new Mapper(file); | |
var data = mapper.Take<MyClass>(0).ToList(); | |
//Data contains a List of IRowData<MyClass> | |
//To access the objects instance you need to iterate over the list and reference the Value property |
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
foreach(var property in item.GetType().GetProperties()) | |
{ | |
if(property.PropertyType.FullName == "System.String") | |
{ | |
if(property.GetValue(item) == null) | |
property.SetValue(item, string.Empty); | |
} | |
} |
NewerOlder