-
Notifications
You must be signed in to change notification settings - Fork 3
/
path---docs-your-first-aggregate-d39f05cb313d5a381d6b.js.map
1 lines (1 loc) · 33.9 KB
/
path---docs-your-first-aggregate-d39f05cb313d5a381d6b.js.map
1
{"version":3,"sources":["webpack:///path---docs-your-first-aggregate-d39f05cb313d5a381d6b.js","webpack:///./.cache/json/docs-your-first-aggregate.json"],"names":["webpackJsonp","433","module","exports","data","allPostTitles","edges","node","frontmatter","title","lesson","category","chapter","type","fields","slug","postBySlug","html","timeToRead","excerpt","cover","date","tags","pathContext"],"mappings":"AAAAA,cAAc,iBAERC,IACA,SAAUC,EAAQC,GCHxBD,EAAAC,SAAkBC,MAAQC,eAAiBC,QAAUC,MAAQC,aAAeC,MAAA,kBAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAAwFC,QAAWC,KAAA,uBAA8BR,MAAQC,aAAeC,MAAA,aAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAAmFC,QAAWC,KAAA,kBAAyBR,MAAQC,aAAeC,MAAA,2BAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAAiGC,QAAWC,KAAA,gCAAuCR,MAAQC,aAAeC,MAAA,QAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAA8EC,QAAWC,KAAA,aAAoBR,MAAQC,aAAeC,MAAA,kBAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAAwFC,QAAWC,KAAA,uBAA8BR,MAAQC,aAAeC,MAAA,aAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAAmFC,QAAWC,KAAA,kBAAyBR,MAAQC,aAAeC,MAAA,uBAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,EAAAC,KAAA,QAA6FC,QAAWC,KAAA,4BAAmCR,MAAQC,aAAeC,MAAA,eAAAC,OAAA,EAAAC,SAAA,cAAAC,QAAA,E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f05cb313d5a381d6b.js","sourcesContent":["webpackJsonp([266882522037697],{\n\n/***/ 433:\n/***/ (function(module, exports) {\n\n\tmodule.exports = {\"data\":{\"allPostTitles\":{\"edges\":[{\"node\":{\"frontmatter\":{\"title\":\"Getting Started\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":1,\"type\":\"docs\"},\"fields\":{\"slug\":\"/getting-started\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Primitives\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/primitives\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Walkthrough Introduction\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/walkthrough-introduction\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Sagas\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/sagas\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Tips and Tricks\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":5,\"type\":\"docs\"},\"fields\":{\"slug\":\"/tips-and-tricks\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Aggregates\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/aggregates\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Aggregate\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-aggregate\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Snapshotting\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/snapshotting\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Articles\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":5,\"type\":\"docs\"},\"fields\":{\"slug\":\"/articles\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Events\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/events\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Commands\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-commands\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Clustering\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/clustering\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Videos\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":5,\"type\":\"docs\"},\"fields\":{\"slug\":\"/videos\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Commands\",\"lesson\":4,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/commands\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Events\",\"lesson\":4,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-events\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Production Readiness\",\"lesson\":4,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/production-readiness\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Specifications\",\"lesson\":5,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/specifications\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Specifications\",\"lesson\":5,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-specifications\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Event Upgrading\",\"lesson\":5,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/event-upgrading\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Subscribers\",\"lesson\":6,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/subscribers\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Aggregate Test\",\"lesson\":6,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-aggregate-test\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Testing Aggregates\",\"lesson\":6,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/testing-aggregates\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Scheduled Jobs\",\"lesson\":7,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/scheduled-jobs\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Aggregate Saga\",\"lesson\":7,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-aggregate-saga\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Akka\",\"lesson\":8,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/akka\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Subscribers\",\"lesson\":8,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-subscribers\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Configuration\",\"lesson\":9,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/configuration\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Projections\",\"lesson\":9,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-projections\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Walkthrough Ending\",\"lesson\":10,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/walkthrough-ending\"}}}]},\"postBySlug\":{\"html\":\"<p>On analysis of the business requirements, it is apparent that the main aggregate entity that exists under the <code class=\\\"language-text\\\">Bank</code> domain context is an <code class=\\\"language-text\\\">Account</code>. The account aggregate needs the ability to be <code class=\\\"language-text\\\">Opened</code> and to <code class=\\\"language-text\\\">Transfer Money</code> to other <code class=\\\"language-text\\\">Account</code>s. Inversely, <code class=\\\"language-text\\\">Account</code>s need to also <code class=\\\"language-text\\\">Receive Money</code>. Lets call our aggregate responsible for representing an account the <code class=\\\"language-text\\\">AccountAggregate</code>.</p>\\n<h2 id=\\\"the-account-aggregate\\\"><a href=\\\"#the-account-aggregate\\\" aria-hidden=\\\"true\\\" class=\\\"anchor\\\"><svg aria-hidden=\\\"true\\\" height=\\\"16\\\" version=\\\"1.1\\\" viewBox=\\\"0 0 16 16\\\" width=\\\"16\\\"><path fill-rule=\\\"evenodd\\\" d=\\\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\\\"></path></svg></a>The Account Aggregate</h2>\\n<p>First we need to make an <code class=\\\"language-text\\\">Identity<></code> for our aggregate.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/AccountId.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">AccountId</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">Identity</span><span class=\\\"token operator\\\"><</span>AccountId<span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token function\\\">AccountId</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">string</span> <span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token keyword\\\">base</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token punctuation\\\">}</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>Then we need to make the <code class=\\\"language-text\\\">Account</code> aggregate state model that will hold our balance:</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/AccountState.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">AccountState</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">AggregateState</span><span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token class-name\\\">Money</span> Balance <span class=\\\"token punctuation\\\">{</span> <span class=\\\"token keyword\\\">get</span><span class=\\\"token punctuation\\\">;</span> <span class=\\\"token keyword\\\">set</span><span class=\\\"token punctuation\\\">;</span> <span class=\\\"token punctuation\\\">}</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>Lets make a simple <code class=\\\"language-text\\\">Money</code> ValueObject<decimal> that will represent money in our application, lets put some simple domain logic into the value object that states that its value must be non-negative.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/ValueObjects/Money.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">Money</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">SingleValueObject</span><span class=\\\"token operator\\\"><</span><span class=\\\"token keyword\\\">decimal</span><span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token function\\\">Money</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">decimal</span> <span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token keyword\\\">base</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">if</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span> <span class=\\\"token operator\\\"><</span> <span class=\\\"token number\\\">0</span><span class=\\\"token punctuation\\\">)</span> <span class=\\\"token keyword\\\">throw</span> <span class=\\\"token keyword\\\">new</span> <span class=\\\"token class-name\\\">ArgumentException</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token function\\\">nameof</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span><span class=\\\"token punctuation\\\">)</span><span class=\\\"token punctuation\\\">;</span>\\n <span class=\\\"token punctuation\\\">}</span>\\n\\n <span class=\\\"token comment\\\">//overload the + and - operators to support the</span>\\n <span class=\\\"token comment\\\">//addition and subtraction of money</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<blockquote>\\n<p>Now we have a value object that represents money in our domain. In the fully worked walkthrough in the Akkatecture repository we have overloaded the <code class=\\\"language-text\\\">+</code> and <code class=\\\"language-text\\\">-</code> operators accordingly.</p>\\n</blockquote>\\n<p>Now we can make our <code class=\\\"language-text\\\">Account</code> aggregate root.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/Account.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">Account</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">AggregateRoot</span><span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token punctuation\\\">,</span> AccountState<span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token function\\\">Account</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token class-name\\\">AccountId</span> aggregateId<span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token keyword\\\">base</span><span class=\\\"token punctuation\\\">(</span>aggregateId<span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token punctuation\\\">}</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>And finally we need to make our aggregate root manager, which will be responsible for supervising, and creating the aggregate roots.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/AccountManager.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">AccountManager</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">AggregateManager</span><span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token punctuation\\\">,</span> Command<span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token operator\\\">></span><span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>We have made the basic skeleton of our aggregate domain. To interact with our aggregate we need to use <strong>commands</strong>. Lets proceed to the next part of the walkthrough.</p>\\n<p><a href=\\\"/docs/your-first-commands\\\">Next →</a></p>\",\"timeToRead\":2,\"excerpt\":\"On analysis of the business requirements, it is apparent that the main aggregate entity that exists under the domain context is an . The…\",\"frontmatter\":{\"title\":\"Your First Aggregate\",\"cover\":\"https://unsplash.it/400/300/?random?BoldMage\",\"date\":\"01/07/2018\",\"category\":\"akkatecture\",\"tags\":[\"walkthrough\",\"akkatecture\",\"aggregate\",\"csharp\",\"dotnet\"]},\"fields\":{\"slug\":\"/your-first-aggregate\"}}},\"pathContext\":{\"slug\":\"/your-first-aggregate\",\"category\":\"akkatecture\"}}\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// path---docs-your-first-aggregate-d39f05cb313d5a381d6b.js","module.exports = {\"data\":{\"allPostTitles\":{\"edges\":[{\"node\":{\"frontmatter\":{\"title\":\"Getting Started\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":1,\"type\":\"docs\"},\"fields\":{\"slug\":\"/getting-started\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Primitives\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/primitives\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Walkthrough Introduction\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/walkthrough-introduction\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Sagas\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/sagas\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Tips and Tricks\",\"lesson\":1,\"category\":\"akkatecture\",\"chapter\":5,\"type\":\"docs\"},\"fields\":{\"slug\":\"/tips-and-tricks\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Aggregates\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/aggregates\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Aggregate\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-aggregate\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Snapshotting\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/snapshotting\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Articles\",\"lesson\":2,\"category\":\"akkatecture\",\"chapter\":5,\"type\":\"docs\"},\"fields\":{\"slug\":\"/articles\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Events\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/events\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Commands\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-commands\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Clustering\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/clustering\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Videos\",\"lesson\":3,\"category\":\"akkatecture\",\"chapter\":5,\"type\":\"docs\"},\"fields\":{\"slug\":\"/videos\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Commands\",\"lesson\":4,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/commands\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Events\",\"lesson\":4,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-events\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Production Readiness\",\"lesson\":4,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/production-readiness\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Specifications\",\"lesson\":5,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/specifications\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Specifications\",\"lesson\":5,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-specifications\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Event Upgrading\",\"lesson\":5,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/event-upgrading\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Subscribers\",\"lesson\":6,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/subscribers\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Aggregate Test\",\"lesson\":6,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-aggregate-test\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Testing Aggregates\",\"lesson\":6,\"category\":\"akkatecture\",\"chapter\":4,\"type\":\"docs\"},\"fields\":{\"slug\":\"/testing-aggregates\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Scheduled Jobs\",\"lesson\":7,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/scheduled-jobs\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Aggregate Saga\",\"lesson\":7,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-aggregate-saga\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Akka\",\"lesson\":8,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/akka\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Subscribers\",\"lesson\":8,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-subscribers\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Configuration\",\"lesson\":9,\"category\":\"akkatecture\",\"chapter\":2,\"type\":\"docs\"},\"fields\":{\"slug\":\"/configuration\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Your First Projections\",\"lesson\":9,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/your-first-projections\"}}},{\"node\":{\"frontmatter\":{\"title\":\"Walkthrough Ending\",\"lesson\":10,\"category\":\"akkatecture\",\"chapter\":3,\"type\":\"docs\"},\"fields\":{\"slug\":\"/walkthrough-ending\"}}}]},\"postBySlug\":{\"html\":\"<p>On analysis of the business requirements, it is apparent that the main aggregate entity that exists under the <code class=\\\"language-text\\\">Bank</code> domain context is an <code class=\\\"language-text\\\">Account</code>. The account aggregate needs the ability to be <code class=\\\"language-text\\\">Opened</code> and to <code class=\\\"language-text\\\">Transfer Money</code> to other <code class=\\\"language-text\\\">Account</code>s. Inversely, <code class=\\\"language-text\\\">Account</code>s need to also <code class=\\\"language-text\\\">Receive Money</code>. Lets call our aggregate responsible for representing an account the <code class=\\\"language-text\\\">AccountAggregate</code>.</p>\\n<h2 id=\\\"the-account-aggregate\\\"><a href=\\\"#the-account-aggregate\\\" aria-hidden=\\\"true\\\" class=\\\"anchor\\\"><svg aria-hidden=\\\"true\\\" height=\\\"16\\\" version=\\\"1.1\\\" viewBox=\\\"0 0 16 16\\\" width=\\\"16\\\"><path fill-rule=\\\"evenodd\\\" d=\\\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\\\"></path></svg></a>The Account Aggregate</h2>\\n<p>First we need to make an <code class=\\\"language-text\\\">Identity<></code> for our aggregate.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/AccountId.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">AccountId</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">Identity</span><span class=\\\"token operator\\\"><</span>AccountId<span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token function\\\">AccountId</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">string</span> <span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token keyword\\\">base</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token punctuation\\\">}</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>Then we need to make the <code class=\\\"language-text\\\">Account</code> aggregate state model that will hold our balance:</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/AccountState.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">AccountState</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">AggregateState</span><span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token class-name\\\">Money</span> Balance <span class=\\\"token punctuation\\\">{</span> <span class=\\\"token keyword\\\">get</span><span class=\\\"token punctuation\\\">;</span> <span class=\\\"token keyword\\\">set</span><span class=\\\"token punctuation\\\">;</span> <span class=\\\"token punctuation\\\">}</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>Lets make a simple <code class=\\\"language-text\\\">Money</code> ValueObject<decimal> that will represent money in our application, lets put some simple domain logic into the value object that states that its value must be non-negative.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/ValueObjects/Money.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">Money</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">SingleValueObject</span><span class=\\\"token operator\\\"><</span><span class=\\\"token keyword\\\">decimal</span><span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token function\\\">Money</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">decimal</span> <span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token keyword\\\">base</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">if</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span> <span class=\\\"token operator\\\"><</span> <span class=\\\"token number\\\">0</span><span class=\\\"token punctuation\\\">)</span> <span class=\\\"token keyword\\\">throw</span> <span class=\\\"token keyword\\\">new</span> <span class=\\\"token class-name\\\">ArgumentException</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token function\\\">nameof</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token keyword\\\">value</span><span class=\\\"token punctuation\\\">)</span><span class=\\\"token punctuation\\\">)</span><span class=\\\"token punctuation\\\">;</span>\\n <span class=\\\"token punctuation\\\">}</span>\\n\\n <span class=\\\"token comment\\\">//overload the + and - operators to support the</span>\\n <span class=\\\"token comment\\\">//addition and subtraction of money</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<blockquote>\\n<p>Now we have a value object that represents money in our domain. In the fully worked walkthrough in the Akkatecture repository we have overloaded the <code class=\\\"language-text\\\">+</code> and <code class=\\\"language-text\\\">-</code> operators accordingly.</p>\\n</blockquote>\\n<p>Now we can make our <code class=\\\"language-text\\\">Account</code> aggregate root.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/Account.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">Account</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">AggregateRoot</span><span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token punctuation\\\">,</span> AccountState<span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token keyword\\\">public</span> <span class=\\\"token function\\\">Account</span><span class=\\\"token punctuation\\\">(</span><span class=\\\"token class-name\\\">AccountId</span> aggregateId<span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token keyword\\\">base</span><span class=\\\"token punctuation\\\">(</span>aggregateId<span class=\\\"token punctuation\\\">)</span>\\n <span class=\\\"token punctuation\\\">{</span>\\n <span class=\\\"token punctuation\\\">}</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>And finally we need to make our aggregate root manager, which will be responsible for supervising, and creating the aggregate roots.</p>\\n<div class=\\\"gatsby-highlight\\\">\\n <pre class=\\\"language-csharp\\\"><code class=\\\"language-csharp\\\"><span class=\\\"token comment\\\">//Walkthrough.Domain/Model/Account/AccountManager.cs</span>\\n<span class=\\\"token keyword\\\">public</span> <span class=\\\"token keyword\\\">class</span> <span class=\\\"token class-name\\\">AccountManager</span> <span class=\\\"token punctuation\\\">:</span> <span class=\\\"token class-name\\\">AggregateManager</span><span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token punctuation\\\">,</span> Command<span class=\\\"token operator\\\"><</span>Account<span class=\\\"token punctuation\\\">,</span> AccountId<span class=\\\"token operator\\\">></span><span class=\\\"token operator\\\">></span>\\n<span class=\\\"token punctuation\\\">{</span>\\n<span class=\\\"token punctuation\\\">}</span></code></pre>\\n </div>\\n<p>We have made the basic skeleton of our aggregate domain. To interact with our aggregate we need to use <strong>commands</strong>. Lets proceed to the next part of the walkthrough.</p>\\n<p><a href=\\\"/docs/your-first-commands\\\">Next →</a></p>\",\"timeToRead\":2,\"excerpt\":\"On analysis of the business requirements, it is apparent that the main aggregate entity that exists under the domain context is an . The…\",\"frontmatter\":{\"title\":\"Your First Aggregate\",\"cover\":\"https://unsplash.it/400/300/?random?BoldMage\",\"date\":\"01/07/2018\",\"category\":\"akkatecture\",\"tags\":[\"walkthrough\",\"akkatecture\",\"aggregate\",\"csharp\",\"dotnet\"]},\"fields\":{\"slug\":\"/your-first-aggregate\"}}},\"pathContext\":{\"slug\":\"/your-first-aggregate\",\"category\":\"akkatecture\"}}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/json-loader!./.cache/json/docs-your-first-aggregate.json\n// module id = 433\n// module chunks = 266882522037697"],"sourceRoot":""}