Skip to content

Instantly share code, notes, and snippets.

View JamesDunne's full-sized avatar

jsd1982 JamesDunne

View GitHub Profile
@JamesDunne
JamesDunne / SqlAsyncConnectionString.cs
Created May 4, 2012 20:58
SqlAsyncConnectionString wrapper class to modify a SQL connection string to add Asynchronous Processing=True if it does not exist
/// <summary>
/// Represents a connection string that is guaranteed to have been altered to enable asynchronous processing.
/// </summary>
public sealed class SqlAsyncConnectionString
{
private readonly string _connectionString;
/// <summary>
/// Creates a connection string prepared for enabling asynchronous processing with an optional connection timeout.
/// </summary>
@JamesDunne
JamesDunne / RFC3339DateTime.cs
Created February 1, 2012 17:01
RFC3339 DateTime struct for C#
public struct RFC3339DateTime : IEquatable<RFC3339DateTime>, IComparable<RFC3339DateTime>
{
private readonly DateTimeOffset _value;
private static readonly string[] _formats = new string[] { "yyyy-MM-ddTHH:mm:ssK", "yyyy-MM-ddTHH:mm:ss.ffK", "yyyy-MM-ddTHH:mm:ssZ", "yyyy-MM-ddTHH:mm:ss.ffZ" };
public RFC3339DateTime(string rfc3339FormattedDateTime)
{
DateTimeOffset tmp;
if (!DateTimeOffset.TryParseExact(rfc3339FormattedDateTime, _formats, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeUniversal, out tmp))
@JamesDunne
JamesDunne / FindConflictingReferences.cs
Created January 4, 2012 20:42 — forked from brianlow/FindConflictingReferences.cs
Find conflicting assembly references
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace MyProject
{
public class UtilityTest
{
@JamesDunne
JamesDunne / moved
Created October 14, 2011 03:18
Simple drop-in ASP.NET ashx to provide a simple yet safe SQL query builder/executor web tool
Moved to https://github.com/JamesDunne/QueryAshxClient
@JamesDunne
JamesDunne / ImmutableObjectGenerator.tt
Created October 6, 2011 03:43
A Visual Studio T4 template for generating immutable object models in C#
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core.dll" #>
<#@ import namespace="System.Linq" #>
<#@ output extension=".generated.cs" #><#
// Describe the immutable model types to generate:
var types = new[] {
new {
name = "ImmutableSample",
comment = "A complete commit object.",
idType = "int",