Skip to content

Instantly share code, notes, and snippets.

View tawman's full-sized avatar

Todd A. Wood tawman

View GitHub Profile
@tawman
tawman / OrganizationParentRelator.cs
Created February 2, 2012 02:53
PetaPocoHierarchy Multi-Poco Mapping Helper
using PetaPocoHierarchy.Models;
namespace PetaPocoHierarchy.Services
{
/// <summary>
/// Set Organization Parent in the Organization Hierarchy
/// </summary>
/// <remarks>
/// Based on logic for mapping demo: http://www.toptensoftware.com/Articles/115/PetaPoco-Mapping-One-to-Many-and-Many-to-One-Relationships
/// </remarks>
@tawman
tawman / OrganizationRepository.cs
Created February 2, 2012 02:52
PetaPocoHierarchy Organization Repository
using System.Collections.Generic;
using PetaPocoHierarchy.Models;
namespace PetaPocoHierarchy.Services
{
public class OrganizationRepository : Repository, IOrganizationRepository
{
public IEnumerable<Organization> GetAll()
{
// SELECT a row of data containing an Organization and Parent Organization
@tawman
tawman / Organization.cs
Created January 29, 2012 22:32
PetaPocoHierarchy Organization POCO
using System;
using System.Linq;
using System.Collections.Generic;
using PetaPoco;
namespace PetaPocoHierarchy.Models
{
public class Organization
{
public Guid Id { get; set; }
@tawman
tawman / PetaPocoHierarchyCreateTable.sql
Created January 29, 2012 22:09
PetaPocoHierarchy Organization Table SQL CREATE Script
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Organization](
[Id] [uniqueidentifier] NOT NULL,
[ParentId] [uniqueidentifier] NULL,
[OrganizationCode] [nvarchar](10) NOT NULL,
@tawman
tawman / LinqExamples.cs
Created January 26, 2012 14:43
Stackoverflow Question: Select list of x via list of y
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace StackOverflowQuestionsTests
{
[TestFixture]
class LinqExamples
@tawman
tawman / IToddWood.cs
Created January 21, 2012 18:44
Implement IToddWood Blog - http://www.wooodcp.com
using System;
using System.Collections.Generic;
namespace WoodConsultingPractice
{
public interface IToddWood
{
IEnumerable<Result> Work<T>(T challenge);
IEnumerable<Memory> Life(Action action);
Post Blog<T>(Result knowledge, Memory experience, T content);