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
/***************************************************************************\ | |
Module Name: SqlUtil.cs | |
Project: GitHub Gist | |
Url: http://go.beeming.net/28WaNE0 | |
A sample class to interact with Microsoft SQL Server for all the basic data access layer operations. | |
The MIT License (MIT) | |
Copyright (c) Gordon Beeming |
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
namespace MyApp.DataAccess | |
{ | |
using System; | |
using System.Configuration; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Threading.Tasks; | |
public static class SqlUtilAsync | |
{ |
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
@ECHO OFF | |
cd /d %~dp0 | |
powershell.exe -ExecutionPolicy Unrestricted -File ".\%~n0.ps1" | |
pause |
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
namespace MyApp.DataAccess | |
{ | |
using System; | |
using System.Configuration; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Threading.Tasks; | |
public static class SqlUtilAsync | |
{ |
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.IO; | |
using System.Security.Cryptography; | |
/// <summary> | |
/// https://gist.github.com/Gordon-Beeming/281e019d0b61bf045bd5 | |
/// </summary> | |
public static class HashHelper | |
{ | |
public enum Algorithms |
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.Threading; | |
using System.Threading.Tasks; | |
public static class AsyncHelpers | |
{ | |
/// <summary> | |
/// Execute's an async Task<T> method which has a void return value synchronously | |
/// </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
[Route("version")] | |
public ActionResult Version() | |
{ | |
var version = "DEV Build?"; | |
var descriptionAttribute = this.GetType().Assembly.GetCustomAttributes<AssemblyDescriptionAttribute>().FirstOrDefault(); | |
if ((descriptionAttribute?.Description ?? version) != version && descriptionAttribute.Description.Length > 0) | |
{ | |
version = descriptionAttribute.Description; | |
} | |
return Content(version); |
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
/*************************************************************************** | |
Module Name: SqlUtilCore.cs | |
Project: GitHub Gist | |
Url: http://go.beeming.net/2uMPzq9 | |
A simple sql utility that uses C# 6's FormattableString to suck out SqlParameters to allow for cleaner API. | |
The MIT License (MIT) | |
Copyright (c) Gordon Beeming |
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.Concurrent; | |
using System.Configuration; | |
using System.Runtime.CompilerServices; | |
namespace Utilities | |
{ | |
public static class CacheMagics | |
{ | |
private static bool cachingEnabled = ConfigurationManager.AppSettings["config:CacheMagicsEnabled"] == "1"; |
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.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Web; | |
namespace GordonBeeming.ApiHelpers | |
{ | |
public static class AsyncHelpers |
OlderNewer