This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Customer is an aggregate root | |
public class Customer : AggregateRootMappedByConvention | |
{ | |
//Customer contains orders, each of which is uniquely identified hence is an entity | |
private readonly List<Order> _orders = new List<Order>(); | |
public void CreateOrder(int id) | |
{ | |
//Does not create an entity, only publishes event. | |
//The entity has localy unique id. Its uniqueness is ensured here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void NHibernate_allows_crud_operations() | |
{ | |
Create(); | |
Read(); | |
Update(); | |
Delete(); | |
} | |
private void Create() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override ValidationResults OnValidate(PurchaseTransaction purchaseTransaction) | |
{ | |
return purchaseTransaction | |
.With(ValidationCheck) | |
.Unless(IsValidateServiceDown) | |
.Try(SendMessageToTransecure) | |
.InCaseOfException(MarkServiceAsDown) | |
.Return(TheResult, OrFailureCodeInCaseOfFailure); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void It_uses_more_specific_rule_if_rule_and_information_is_present() | |
{ | |
Given(new ProductType("air", null, ProductCategory.AirOnly), | |
new ProductType("air", "someSpecialWeirdProduct", ProductCategory.LandOnly)) | |
.ItMaps(new ProductReference("air", "someSpecialWeirdProduct")) | |
.To(ProductCategory.LandOnly); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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/"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void After_successfully_deploying_a_component_it_triggers_its_start() | |
{ | |
Given("id", | |
Created(), | |
LockRequested(), | |
Locked(), | |
VersionDetermined(), | |
DeploymentPlanned("A", "1"), | |
DeploymentPlanned("B", "2"), |
OlderNewer