Skip to content

Instantly share code, notes, and snippets.

View msajid's full-sized avatar

Muhammad Sajid msajid

  • Stockholm, Sweden
View GitHub Profile
using Microsoft.Azure.Cosmos;
using System;
using System.Threading.Tasks;
namespace TestTransactionalBatchConsole
{
class Program
{
static async Task Main(string[] args)
{
@msajid
msajid / AppConfigConsoleDemo.Program.cs
Created November 17, 2019 14:19
Azure App Configuration in a .NET Core Console App
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
using System;
using System.Threading.Tasks;
namespace AppConfigConsoleDemo
{
class Program
@msajid
msajid / AppConfigConsoleDemo.csproj
Created November 17, 2019 13:51
Add reference to Microsoft.Extensions.Configuration.AzureAppConfiguration
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration"
Version="2.0.0-preview-010050001-38" />
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
[assembly: FunctionsStartup(typeof(AzureFunctionAppWithDIAndScrutor.Startup))]
namespace AzureFunctionAppWithDIAndScrutor
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using System.Threading.Tasks;
namespace AzureFunctionAppWithDIAndScrutor
{
public class SimpleFunction
{
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
[assembly: FunctionsStartup(typeof(AzureFunctionAppWithDIAndScrutor.Startup))]
namespace AzureFunctionAppWithDIAndScrutor
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
@msajid
msajid / csbase64encode
Last active August 29, 2015 14:08
csbase64encode
public static string CreateBase64Hash(string message)
{
var encoding = new UTF8Encoding();
byte[] messageBytes = encoding.GetBytes(message);
return Convert.ToBase64String(messageBytes);
}
@msajid
msajid / RetryManager
Last active August 29, 2015 14:07
a custom retry helper class with Action and Func of T.
using System;
using System.Threading;
namespace RetrySolution
{
public static class RetryManager
{
private const int RetryCount = 3;
private const int RetryTimeoutInMillis = 100;
public static void TryExecute(Action action)
{
@msajid
msajid / feedxmlsample
Created August 26, 2014 18:06
Atom feed sample from service bus
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Publicly Listed Services</title>
<subtitle type="text">This is the list of publicly-listed services currently available.</subtitle>
<id>uuid:82f1e291-8ab5-48ac-bf17-09353ad0e980;id=354423</id>
<updated>2014-08-26T18:00:48Z</updated>
<generator>Service Bus 1.1</generator>
<entry>
<id>uuid:82f1e291-8ab5-48ac-bf17-09353ad0e980;id=354424</id>
<title type="text">NameOfTheService</title>
<updated>2014-08-26T18:00:49Z</updated>
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" aspNetCompatibilityEnabled="true" />
<bindings>
<webHttpRelayBinding>
<binding name="default">
<security relayClientAuthenticationType="None" />
</binding>
</webHttpRelayBinding>