Add entity support to Ncqrs.
An aggregate root covers all state changes by events. These events are stored and aggregate roots can rebuild themself from these events by re-applying them.
| public class SalesOrderService | |
| { | |
| // A command should map to this method. | |
| public void AddProducToSalesOrder(Guid salesOrderId, Guid productId, int quantity) | |
| { | |
| using(var work = GetUnitOfWork()) | |
| { | |
| var order = work.GetById<SalesOrder>(salesOrderId); | |
| var product = work.GetById<Product>(productId); |
| using System; | |
| using System.Collections.Generic; | |
| using Scrumr.Events.Project; | |
| namespace Scrumr.Domain | |
| { | |
| public class Project : ScrumrAggregateRoot | |
| { | |
| private string _name; | |
| private List<Guid> _members = new List<Guid>(); |
| using System; | |
| using System.Linq; | |
| using FluentAssertions; | |
| using Ncqrs.Commanding.CommandExecution; | |
| using Ncqrs.Commanding.CommandExecution.Mapping.Fluent; | |
| using Ncqrs.Spec; | |
| using Scrumr.Commands; | |
| using Scrumr.Events.Project; | |
| namespace Scrumr.Domain.Tests.Scenarios.Creating_a_new_project |
| C:\github\larsw\ncqrs-master>tools\nant\nant.exe /f:"MAIN.build" | |
| NAnt 0.91 (Build 0.91.3881.0; alpha2; 17.08.2010) | |
| Copyright (C) 2001-2010 Gerry Shaw | |
| http://nant.sourceforge.net | |
| Buildfile: file:///C:/github/larsw/ncqrs-master/MAIN.build | |
| Target framework: Microsoft .NET Framework 4.0 | |
| Target(s) specified: build |
This is just an braindrump and rolling gist that reflect the thought about POCO support for Ncqrs.
OnCustomerNameChanged(NameChanged e) that update internal state.So minimal code is:
$ git config --global http.proxy http://www-proxy.nl.int.atosorigin.com:8080
$ git config --global https.proxy http://www-proxy.nl.int.atosorigin.com:8080
| {"Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"} | |
| Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) | |
| at FluentAssertions.Verification.Fail(String format, Object expected, Object actual, String reason, Object[] reasonParameters, Object[] args) | |
| at FluentAssertions.Verification.Verify(Boolean condition, String failureMessage, Object expected, Object actual, String reason, Object[] reasonParameters) | |
| at FluentAssertions.Verification.Verify(Func`1 condition, String failureMessage, Objec |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Linq.Expressions; | |
| using LinqKit; | |
| using System.Text.RegularExpressions; | |
| namespace DynamicQueryProblem |
| private static long? GetKnownVersion(ICommand cmd) | |
| { | |
| const BindingFlags allInstance = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; | |
| var knownVersionAttributeType = typeof (KnownVersionAttribute); | |
| var commandType = cmd.GetType(); | |
| var knownVersionProperties = | |
| commandType.GetProperties(allInstance).Where(p => p.IsDefined(knownVersionAttributeType, false)); | |
| if (knownVersionProperties.IsEmpty()) |