Skip to content

Instantly share code, notes, and snippets.

View jburditt's full-sized avatar

Jebb Burditt jburditt

View GitHub Profile
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"WBS.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
@jburditt
jburditt / MVCCheckboxes.cs
Created September 1, 2015 17:16
MVC Checkboxes
/*
Here’s a neat nuget for packing lists of checkboxes based on a MVC model. Currently implementing this for activities on the signup form.
http://www.codeproject.com/Tips/613785/How-to-Use-CheckBoxListFor-With-ASP-NET-MVC
note, as shown below, you do actually need to get the list of available ones twice.
There is also relatively new to .net html.enumdropdownlist for. I think I will implement this for the gender selection.
https://msdn.microsoft.com/en-us/library/system.web.mvc.html.selectextensions.enumdropdownlistfor(v=vs.118).aspx
*/
@jburditt
jburditt / AssertHelper.cs
Last active May 24, 2016 23:12
Assert Helper Functions e.g. Test Object fields
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
//http://stackoverflow.com/questions/23530982/c-sharp-asserting-two-objects-are-equal-in-unit-tests
namespace Tests.Helpers
{
public class AssertHelper
{
public static void HasEqualFieldValues<T>(T expected, T actual)
using System.Linq;
using System.Security.Claims;
using Newtonsoft.Json;
namespace Account
{
public static class ClaimsExtensions
{
public static string Get(this ClaimsIdentity identity, string type)
{
@jburditt
jburditt / DataTableHelpers.cs
Created February 11, 2017 01:12
DataReaderHelper
public static class DataTableHelpers
{
public static IEnumerable<T> To<T>(this DataTable data)
{
Mapper.Initialize(cfg =>
{
MapperRegistry.Mappers.Add(new AutoMapper.Data.DataReaderMapper { YieldReturnEnabled = true });
});
Mapper.CreateMap<IDataReader, T>();
@jburditt
jburditt / NamingConventions.cs
Created August 29, 2017 16:08
C# Naming Conventions
/// C# Naming Conventions
/// References
/// Source https://social.msdn.microsoft.com/Forums/vstudio/en-US/6226f8bb-d00b-4cd5-abf5-3a1263e6f62f/c-boolean-naming-conventions?forum=csharpgeneral
/// Author https://social.msdn.microsoft.com/profile/eyal-shilony/?ws=usercard-mini
/// Pascal Case - Capitalized the first letter for each word in the context e.g. HelloWorld.
/// Camel Case - Capitalized the first letter for each word in the context except the first word e.g. helloWorld.
/// Use uppercase notation when you have to deal with acronyms e.g. IP, UI.
@jburditt
jburditt / DatabaseCopy.cs
Created November 29, 2017 00:13
Database Copy and Merge program
using System;
using System.Diagnostics;
using ServiceStack.OrmLite;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
namespace Database.Copy
{
class Program
@jburditt
jburditt / OrmLite.Include.cs
Created November 29, 2017 00:14
Converted T4 to C#
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Database.Copy
@jburditt
jburditt / AmazonConfigurationProvider.cs
Last active January 24, 2018 19:29
Amazon Elastic Beanstalk Application Settings
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json.Linq;
using System.IO;
using System.Linq;
namespace ExampleProject
{
public class AmazonConfigurationProvider : ConfigurationProvider
{
private const string ConfigurationFilename = @"C:\Program Files\Amazon\ElasticBeanstalk\config\containerconfiguration";
@jburditt
jburditt / aws-windows-deployment-manifest.json
Last active March 14, 2018 22:59
.NET Core to Pipelines Build
{
"manifestVersion": 1,
"deployments": {
"aspNetCoreWeb": [
{
"name": "app",
"parameters": {
"appBundle": ".",
"iisPath": "/",