Skip to content

Instantly share code, notes, and snippets.

View SzymonPobiega's full-sized avatar
🏠
Working from home

Szymon Pobiega SzymonPobiega

🏠
Working from home
View GitHub Profile
public class EndpointConfig : IConfigureThisEndpoint
{
public void Customize(BusConfiguration busConfiguration)
{
var container = new UnityContainer();
busConfiguration.UseTransport<MsmqTransport>();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();
namespace NServiceBus.AcceptanceTests.Routing
{
using System;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.Customization;
using EndpointTemplates;
using Features;
using NServiceBus.Config;
using NServiceBus.Pipeline;
@SzymonPobiega
SzymonPobiega / AsyncTransactionFlow.cs
Last active May 10, 2016 15:03
Async transaction flow problem
using System.Threading.Tasks;
using System.Transactions;
using NUnit.Framework;
[TestFixture]
public class TransactionFlowTest
{
[Test]
public void It_should_propagate_transaction_current_down_the_stack_sync()
{
@SzymonPobiega
SzymonPobiega / gist:5220595
Last active April 25, 2024 17:19
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@SzymonPobiega
SzymonPobiega / gist:4538653
Created January 15, 2013 13:30
Why I _love_ event sourcing
[Test]
public void After_successfully_deploying_a_component_it_triggers_its_start()
{
Given("id",
Created(),
LockRequested(),
Locked(),
VersionDetermined(),
DeploymentPlanned("A", "1"),
DeploymentPlanned("B", "2"),
@SzymonPobiega
SzymonPobiega / gist:2889459
Created June 7, 2012 15:30
log4net config
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<root>
<level value="INFO"/>
<appender-ref ref="File"/>
<appender-ref ref="Console"/>
</root>
<logger name="NHibernate">
<level value="WARN" />
</logger>
@SzymonPobiega
SzymonPobiega / gist:2657868
Created May 11, 2012 06:13
Branch switching script
#
# The script switches IIS web applications to point to some other directory. It is very usefull when frequently changing branches.
# The script assumes SVN-ish branch structure like this:
# Root
# |
# |--Branches
# | |
# | |--Branch 1
# | |
# | \--Branch 2
@SzymonPobiega
SzymonPobiega / gist:2358879
Created April 11, 2012 11:59
Too much DRY
public static T NullArgumentLogAndThrow<T>(this ILog log, T arg)
{
if (arg.IsNotNull()) return arg;
// get calling method
var ex = new ArgumentNullException(typeof(T).Name);
log.Fatal(new StackTrace().GetFrame(1).GetMethod().Name, ex);
log.Fatal(new StackTrace().ToString());
throw ex;
}
@SzymonPobiega
SzymonPobiega / gist:1617321
Created January 15, 2012 21:04
Here's how you use ReferenceDataManager
ObjectId hierarchyId;
var builder = new ChangeSetBuilder(objectFacade, null);
{
var hierarchy = builder.CreateHierarchy();
hierarchyId = hierarchy.Id;
var parentUnit = builder.CreateUnit("Parent", new Address("Lubicz", "23", "Krakow", "PL"));
var childUnit = builder.CreateUnit("Child", null);
builder.SetHierarchyRoot(hierarchy, parentUnit);
builder.SetParent(hierarchy, childUnit, parentUnit);
@SzymonPobiega
SzymonPobiega / gist:1148931
Created August 16, 2011 12:05
Subscriptions
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>simon_v subscriptions in Google Reader</title>
</head>
<body>
<outline title="Publiczne" text="Publiczne">
<outline text=".neting in the free world"
title=".neting in the free world" type="rss"
xmlUrl="http://feeds.feedburner.com/jakubg" htmlUrl="http://blog.gutek.pl/"/>