Skip to content

Instantly share code, notes, and snippets.

View erikdietrich's full-sized avatar

Erik Dietrich erikdietrich

View GitHub Profile
@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);
@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 / 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);
using System;
using System.Collections.Generic;
using System.Linq;
namespace CodeReadability
{
public class Arithmetic
{
public static int FirstProcessNumberA(int number)
{
@erikdietrich
erikdietrich / Readability2.cs
Created November 7, 2015 20:51
The second installment of the experiment is about cyclomatic complexity.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeReadability
{
public class CyclomaticComplexity
{