Skip to content

Instantly share code, notes, and snippets.

View erikdietrich's full-sized avatar

Erik Dietrich erikdietrich

View GitHub Profile
@erikdietrich
erikdietrich / DTO.tt
Created January 29, 2014 17:54
Sort of poorly named, but this is where the IWhatever interfaces are defined for the domain objects to implement.
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"..\WebPortal.Domain\Entities.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);
@erikdietrich
erikdietrich / Entities.tt
Created January 29, 2014 17:52
This generates the actual domain objects that reside underneath the repo layer.
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"Entities.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);
@erikdietrich
erikdietrich / Entities.Context.tt
Created January 29, 2014 17:47
This is the modified context file for the entities.
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"Entities.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 loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
using System;
using System.Collections.Generic;
using System.Linq;
namespace CodeReadability
{
public class Arithmetic
{
public static int FirstProcessNumberA(int number)
{
@erikdietrich
erikdietrich / BowlingScoreCalculator.cs
Created November 8, 2012 19:39
Bowling Score Calculator
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public class BowlingScoreCalculator
{
private readonly Frame[] _frames = new Frame[10];
@erikdietrich
erikdietrich / BowlingTest.cs
Created November 8, 2012 20:01
Bowling Score Calculator Test
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
[TestClass]
public class BowlingTest
{
@erikdietrich
erikdietrich / Frame.cs
Created November 8, 2012 20:06
The frame class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public class Frame
@erikdietrich
erikdietrich / TenthFrame.cs
Created November 8, 2012 20:11
The Tenth Frame Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public class TenthFrame : Frame
@erikdietrich
erikdietrich / TenthFrameTest.cs
Created November 8, 2012 20:12
The test class for tenth frame
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
[TestClass]
@erikdietrich
erikdietrich / ExtendedAssert.cs
Created November 8, 2012 20:15
Extended Assert class I wrote a long time ago when I was coming from NUnit to MSTest
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public static class ExtendedAssert