Skip to content

Instantly share code, notes, and snippets.

public static class DomainEvents
{
public static IContainer Container { get; set; }
public static IDomainEvent LastRaised { get; private set; }
public static void Raise<T>(T args) where T : IDomainEvent
{
if (Container != null)
foreach (var handler in Container.GetAllInstances<IHandler<T>>())
handler.Handle(args);
// interfaces
public interface IResult<T>
{
T GetResult();
}
public interface IEntityQuerier
{
void Execute(ISession session, Guid parameter);
public interface IUnitOfWork
{
void Register(IWorkItem workItem);
void Commit();
void Rollback();
}
select
so_pk.name as PrimaryKeyTable
, sc_pk.name as PrimaryKeyColumn
, so_fk.name as ForeignKeyTable
, sc_fk.name as ForeignKeyColumn
from
sysforeignkeys sfk
inner join sysobjects so on so.id = sfk.constid
inner join sysobjects so_pk on sfk.rkeyid = so_pk.id
inner join sysobjects so_fk on sfk.fkeyid = so_fk.id
-- 1. set up script tables
-- create drop unique constraint statements
declare @drop_unique_constraints table ([sql] nvarchar(max))
insert into @drop_unique_constraints
select 'alter table [' + tables.name + '] drop constraint ' + so.name
from sys.objects so
join information_schema.constraint_column_usage iscon on so.name = iscon.constraint_name
join sys.columns columns on so.parent_object_id = columns.object_id
and iscon.column_name = columns.name
@echo off
powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {Import-Module '.\lib\psake\psake.psm1'; invoke-psake -t default;}"
pause
[auth]
bb1.prefix = https://bitbucket.org/
bb1.username = {{personal username}}
bb1.password = {{personal password}}
bb2.prefix = https://bitbucket.org/{{work account}}/
bb2.username = {{work username}}
bb2.password = {{work password}}
bb3.prefix = https://{{work username}}@bitbucket.org/{{work account}}/
// old method
public override T[] Filter<T>(IEnumerable<T> filterableObjects)
{
var filteredObjects = new List<T>();
string[] searchTerms = GetCommaDelimitedSearchTerms();
foreach (T filterableObject in filterableObjects)
{
object[] values = _criterion.GetValues(filterableObject);
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
public static string Prettify(this Type type)
{
var provider = new Microsoft.CSharp.CSharpCodeProvider();
return provider.GetTypeOutput(new System.CodeDom.CodeTypeReference(type));
}