- Aggregate roots should not refer to any other aggregate roots, even in the constructor. Only the id of related aggregate roots is allowed.
- Constructors can only accept ids and value types.
- No setter properties are allowed. Use only methods for mutating state.
- All business rules should be coded in the aggregate roots. Querying is the only type of "business rules" that are allowed outside of aggregate roots.
- Use domain events to signal events in the domain. This is how related aggregate roots can get notified of what happens in other aggregate roots.
- Log all non-standard exits from aggregate root methods. For example, return statements in the middle must have a logging statement that explains the decision to exit.
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 class ContextFactory | |
{ | |
public static ICommandQueryContext CreateContext() | |
{ | |
// this environment variable determines if we are running inside TeamCity | |
if (Environment.GetEnvironmentVariable("TEAMCITY_PROJECT_NAME") == null) | |
return new InMemoryContext(); | |
// we are inside TeamCity, use a database with unique name | |
// that includes test method and test class |
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
var serializer = new XmlSerializer(command.GetType()); | |
MemoryStream stream = null; | |
try | |
{ | |
stream = new MemoryStream(); | |
var streamRef = stream; | |
using (var writer = new XmlTextWriter(stream, Encoding.Unicode)) | |
{ | |
// stream is owned by writer and will be disposed automatically | |
stream = null; |
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
6907067014839121052034232957437347382888368781532520019311054659093702822564971162269141121965617545613897865904269544243721348093953041840506282278098321 |
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
param([switch]$verbose, [switch]$v) | |
$TeamCity = $env:TEAMCITY_PROJECT_NAME | |
# read list of files to ignore | |
$ignoredFiles = @{} | |
$filesWithoutIssues = @{} | |
Get-Content .\StyleCop.IgnoredFiles.txt | % { | |
if (Test-Path($_)) | |
{ | |
$item = Get-ChildItem $_ |
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"?> | |
<Project ToolsVersion="4.0" DefaultTargets="StyleCop" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="tools\MSBuild Extension Pack\bin\MSBuild.ExtensionPack.tasks"/> | |
<UsingTask AssemblyFile="$(MSBuildProjectDirectory)\tools\StyleCop-4.7\StyleCop.dll" TaskName="StyleCopTask"/> | |
<Target Name="StyleCop"> | |
<PropertyGroup> | |
<BuildOutputDirectory>$(MSBuildProjectDirectory)\StyleCop</BuildOutputDirectory> | |
<StyleCopOutputFile>$(BuildOutputDirectory)\StyleCopViolations.xml</StyleCopOutputFile> | |
<StyleCopTestOutputFile>$(BuildOutputDirectory)\StyleCopTestViolations.xml</StyleCopTestOutputFile> |
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
(function () { | |
//'use strict'; allow default mode here, to be able to capture more detail | |
angular.module('PortalModule') | |
.config(ExceptionHandlerDecorator); | |
function ExceptionHandlerDecorator($provide) { | |
$provide.decorator('$exceptionHandler', ['$delegate', '$injector', function ($delegate, $injector) { | |
var apiUrl = '/api/logerror'; | |
return function (exception, cause) { |
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
(function () { | |
'use strict'; | |
angular.module('PortalModule') | |
.factory('httpRequestInterceptor', HttpRequestInterceptor); | |
function HttpRequestInterceptor($q, toaster) { | |
return { | |
responseError: function (response) { | |
if (response.status === 500) { |
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
(function () { | |
'use strict'; | |
angular.module('PortalModule') | |
.factory('Toaster', ToasterProvider); | |
function ToasterProvider(toaster) { | |
return { | |
success: function (title, body) { | |
toaster.pop('success', title, body); |
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
#foreach line in the input, until empty line | |
# [DateTime]::Parse('2014-05-28 12:43:43 +0200', [System.Globalization.CultureInfo]::InvariantCulture) | |
# try some (known) variations | |
$regex = New-Object System.Text.RegularExpressions.Regex('(?i)(HMO-|HMO -|HMO |HMO - )(\d+)') | |
$issueNumbers = @{} | |
$input | % { $regex.Matches($_) } | % { | |
$issueNumber = "HMO-$($_.Groups[2])" | |
if (-not $issueNumbers.ContainsKey($issueNumber)) |
OlderNewer