├── .gitignore ├── Sample.AppService ├── AggregateFactory.cs ├── Funds │ ├── AssociateShareClassToDocumentCommandHandler.cs │ ├── CreateDocumentCommandHandler.cs │ └── CreateShareClassCommandHandler.cs ├── People │ ├── CreatePersonCommandHandler.cs │ ├── KillPersonCommandHandler.cs │ └── MovePersonCommandHandler.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.AppService.csproj ├── Sample.AppServiceHost ├── BusConfigModule.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Sample.AppServiceHost.csproj ├── StorageConfigModule.cs └── app.config ├── Sample.Client.Web ├── BusConfigModule.cs ├── Content │ ├── Site.css │ └── themes │ │ └── base │ │ ├── images │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ │ └── jquery-ui.css ├── Controllers │ ├── FundsController.cs │ ├── HomeController.cs │ └── PersonController.cs ├── Global.asax ├── Global.asax.cs ├── Models │ └── DocumentViewModel.cs ├── NHibernateConfigModule.cs ├── Properties │ └── AssemblyInfo.cs ├── RavenConfigModule.cs ├── Sample.Client.Web.csproj ├── Sample.Client.Web.csproj.user ├── Views │ ├── Funds │ │ ├── CreateDocument.cshtml │ │ ├── CreateShare.cshtml │ │ ├── Document.cshtml │ │ ├── Documents.cshtml │ │ ├── Index.cshtml │ │ └── Shares.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── Person │ │ ├── AddressChanges.cshtml │ │ ├── Create.cshtml │ │ ├── DeadPersons.cshtml │ │ ├── Index.cshtml │ │ └── Move.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config └── Web.config ├── Sample.Denormalizer ├── Funds │ ├── DocumentUpdater.cs │ └── ShareClassUpdater.cs ├── People │ ├── AddressChangesUpdater.cs │ └── PersonUpdater.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.Denormalizer.csproj ├── Sample.DenormalizerHost ├── BusConfigModule.cs ├── NHibernateStorageConfigModule.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── RavenStorageConfigModule.cs ├── Sample.DenormalizerHost.csproj └── app.config ├── Sample.DomainModel ├── Funds │ ├── AccessionNumber.cs │ ├── Document.cs │ ├── DocumentShareClassAssociation.cs │ ├── ShareClass.cs │ ├── ShareClassType.cs │ └── Ticker.cs ├── People │ ├── Address.cs │ ├── Person.cs │ └── PersonName.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.DomainModel.csproj ├── Sample.Messages ├── Commands │ ├── Funds │ │ ├── AssociateShareClassToDocument.cs │ │ ├── CreateDocument.cs │ │ └── CreateShareClass.cs │ └── People │ │ ├── CreatePerson.cs │ │ ├── KillPerson.cs │ │ └── MovePerson.cs ├── Events │ ├── Funds │ │ ├── DocumentAssociatedWithShareclass.cs │ │ ├── DocumentCreated.cs │ │ └── ShareClassCreated.cs │ └── People │ │ ├── PersonCreated.cs │ │ ├── PersonDied.cs │ │ └── PersonMoved.cs ├── IEvent.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.Messages.csproj ├── Sample.QueryService ├── IPersonQueryService.cs ├── PersonQueryService.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.QueryService.csproj ├── Sample.ReadModel.NHibernatePersistence ├── NHibernateMappings.cs ├── Properties │ └── AssemblyInfo.cs ├── Sample.ReadModel.NHibernatePersistence.csproj └── XmlMappings │ ├── Funds │ ├── Document.hbm.xml │ └── ShareClass.hbm.xml │ └── People │ ├── AddressChanges.hbm.xml │ └── Person.hbm.xml ├── Sample.ReadModel ├── Funds │ ├── Document.cs │ └── ShareClass.cs ├── People │ ├── AddressChanges.cs │ ├── DeadPerson.cs │ └── Person.cs ├── Properties │ └── AssemblyInfo.cs ├── ReadModelEntity.cs └── Sample.ReadModel.csproj ├── Sample.Tests ├── MessagesSerializationTests.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.Tests.csproj ├── Sample.sln ├── lib ├── Autofac │ ├── Autofac License.txt │ ├── Autofac.Configuration.dll │ ├── Autofac.Integration.Mef.dll │ ├── Autofac.Integration.Mvc.dll │ ├── Autofac.Integration.Wcf.dll │ ├── Autofac.Integration.Web.Mvc.dll │ ├── Autofac.Integration.Web.dll │ ├── Autofac.XML │ └── Autofac.dll ├── CommonDomain │ ├── CommonDomain.dll │ ├── CommonDomain.pdb │ └── CommonDomain.xml ├── EventStore │ ├── EventStore.dll │ ├── EventStore.pdb │ ├── EventStore.xml │ ├── persistence │ │ ├── mongo │ │ │ ├── EventStore.Persistence.MongoPersistence.dll │ │ │ ├── EventStore.Persistence.MongoPersistence.pdb │ │ │ ├── License.txt │ │ │ ├── MongoDB.Bson.dll │ │ │ └── MongoDB.Driver.dll │ │ └── raven │ │ │ ├── EventStore.Persistence.RavenPersistence.dll │ │ │ ├── EventStore.Persistence.RavenPersistence.pdb │ │ │ ├── Json.NET License.txt │ │ │ ├── MissingBitsFromClientProfile.dll │ │ │ ├── Newtonsoft.Json.dll │ │ │ ├── Raven.Abstractions.dll │ │ │ ├── Raven.Client.Lightweight.dll │ │ │ ├── Raven.Json.dll │ │ │ └── license.txt │ └── serialization │ │ ├── RavenJson │ │ ├── EventStore.Serialization.RavenJson.dll │ │ └── EventStore.Serialization.RavenJson.pdb │ │ ├── json-net │ │ ├── EventStore.Serialization.Json.dll │ │ ├── EventStore.Serialization.Json.pdb │ │ └── license.txt │ │ └── servicestack │ │ ├── EventStore.Serialization.ServiceStack.dll │ │ ├── EventStore.Serialization.ServiceStack.pdb │ │ └── LICENSE.txt ├── NHibernate │ ├── Iesi.Collections.dll │ ├── Iesi.Collections.pdb │ ├── Iesi.Collections.xml │ ├── NHibernate.dll │ ├── NHibernate.pdb │ ├── NHibernate.xml │ ├── nhibernate-configuration.xsd │ └── nhibernate-mapping.xsd ├── NanoMessageBus │ ├── Autofac.dll │ ├── Autofac.xml │ ├── NLog.dll │ ├── NanoMessageBus.dll │ ├── NanoMessageBus.pdb │ ├── NanoMessageBus.xml │ ├── Serialization │ │ ├── Json.Net │ │ │ ├── NanoMessageBus.Serialization.Json.dll │ │ │ └── NanoMessageBus.Serialization.Json.pdb │ │ └── ProtocolBuffers.Net │ │ │ ├── NanoMessageBus.Serialization.ProtocolBuffers.dll │ │ │ └── NanoMessageBus.Serialization.ProtocolBuffers.pdb │ ├── SubscriptionStorage.sql │ ├── SubscriptionStorage │ │ └── Raven │ │ │ ├── AsyncCtpLibrary.dll │ │ │ ├── MissingBitsFromClientProfile.dll │ │ │ ├── NanoMessageBus.SubscriptionStorage.Raven.dll │ │ │ ├── NanoMessageBus.SubscriptionStorage.Raven.pdb │ │ │ ├── Raven.Abstractions.dll │ │ │ └── Raven.Client.Lightweight.dll │ └── log4net.dll ├── Newtonsoft.Json │ ├── Newtonsoft.Json.dll │ ├── Newtonsoft.Json.pdb │ └── Newtonsoft.Json.xml ├── RavenDB │ ├── .NET 3.5 │ │ ├── MissingBitsFromClientProfile.dll │ │ ├── Newtonsoft.Json.Net35.dll │ │ ├── Raven.Abstractions-3.5.dll │ │ ├── Raven.Client.Lightweight-3.5.dll │ │ └── Raven.Json-3.5.dll │ ├── .NET 4.0 │ │ ├── AsyncCtpLibrary.dll │ │ ├── MissingBitsFromClientProfile.dll │ │ ├── Newtonsoft.Json.dll │ │ ├── Raven.Abstractions.dll │ │ ├── Raven.Client.Lightweight.dll │ │ └── Raven.Json.dll │ └── license.txt ├── StorageAccess │ ├── StorageAccess.NHibernate.dll │ ├── StorageAccess.Raven.dll │ └── StorageAccess.dll ├── gallio │ ├── Gallio.dll │ ├── Gallio.pdb │ └── MbUnit.dll ├── log4net │ ├── log4net.dll │ ├── log4net.xml │ └── log4net.xsd └── protobuf-net │ ├── License.txt │ ├── protobuf-net.dll │ └── protobuf-net.pdb ├── log4net.xml ├── readme.markdown └── sample.gallio /.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | Bin 3 | bin 4 | output 5 | App.config 6 | Web.config 7 | *.user 8 | *.suo 9 | _ReSharper.* 10 | *.ReSharper* 11 | *.Cache 12 | *.cache 13 | ~$* -------------------------------------------------------------------------------- /Sample.AppService/AggregateFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CommonDomain.Persistence; 6 | using CommonDomain; 7 | using System.Reflection; 8 | 9 | namespace Sample.AppService 10 | { 11 | /// 12 | /// Factory for creating aggregates from with their Id using a private constructor that accespts 13 | /// only one paramenter, the id of the aggregate to create. 14 | /// This factory is used by the event store to create an aggregate prior to replaying it's events. 15 | /// 16 | public class AggregateFactory : IConstructAggregates 17 | { 18 | public IAggregate Build(Type type, Guid id, IMemento snapshot) 19 | { 20 | ConstructorInfo constructor = type.GetConstructor( 21 | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(Guid) }, null); 22 | 23 | return constructor.Invoke(new object[] { id }) as IAggregate; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sample.AppService/Funds/AssociateShareClassToDocumentCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Commands.Funds; 6 | using NanoMessageBus; 7 | using CommonDomain.Persistence; 8 | using Sample.DomainModel.Funds; 9 | 10 | namespace Sample.AppService.Funds 11 | { 12 | public class AssociateShareClassToDocumentCommandHandler : IHandleMessages 13 | { 14 | private readonly IRepository repository; 15 | 16 | public AssociateShareClassToDocumentCommandHandler(IRepository repository) 17 | { 18 | this.repository = repository; 19 | } 20 | 21 | public void Handle(AssociateShareClassToDocument message) 22 | { 23 | Document document = repository.GetById(message.DocumentId, int.MaxValue); 24 | 25 | DocumentShareClassAssociation association = 26 | new DocumentShareClassAssociation(document.Id, message.ShareClassId, ShareClassType.CreateFromString(message.ShareClassType)); 27 | 28 | document.AssociateWithShareClass(association); 29 | 30 | repository.Save(document, Guid.NewGuid(), null); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sample.AppService/Funds/CreateDocumentCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Commands.Funds; 6 | using NanoMessageBus; 7 | using CommonDomain.Persistence; 8 | using Sample.DomainModel.Funds; 9 | 10 | namespace Sample.AppService.Funds 11 | { 12 | public class CreateDocumentCommandHandler : IHandleMessages 13 | { 14 | private readonly IRepository repository; 15 | 16 | public CreateDocumentCommandHandler(IRepository repository) 17 | { 18 | this.repository = repository; 19 | } 20 | 21 | public void Handle(CreateDocument message) 22 | { 23 | Console.WriteLine(message.AccessionNumber); 24 | Document document = new Document(message.Id, new AccessionNumber(message.AccessionNumber)); 25 | repository.Save(document, Guid.NewGuid(), null); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sample.AppService/Funds/CreateShareClassCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Commands.Funds; 6 | using NanoMessageBus; 7 | using CommonDomain.Persistence; 8 | using Sample.DomainModel.Funds; 9 | 10 | namespace Sample.AppService.Funds 11 | { 12 | public class CreateShareClassCommandHandler : IHandleMessages 13 | { 14 | private readonly IRepository repository; 15 | 16 | public CreateShareClassCommandHandler(IRepository repository) 17 | { 18 | this.repository = repository; 19 | } 20 | 21 | public void Handle(CreateShareClass message) 22 | { 23 | ShareClass share = new ShareClass(message.Id, new Ticker(message.Ticker), ShareClassType.CreateFromString(message.Type)); 24 | 25 | repository.Save(share, Guid.NewGuid(), null); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sample.AppService/People/CreatePersonCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NanoMessageBus; 6 | using Sample.Messages.Commands; 7 | using CommonDomain.Persistence; 8 | using Sample.DomainModel; 9 | using Sample.DomainModel.People; 10 | using Sample.Messages.Commands.People; 11 | 12 | namespace Sample.AppService.People 13 | { 14 | /// 15 | /// Command handler for the CreatePerson command. 16 | /// Will construct a new Person Aggregate Root and store it in the repository. 17 | /// 18 | public class CreatePersonCommandHandler : IHandleMessages 19 | { 20 | private readonly IRepository repository; 21 | 22 | public CreatePersonCommandHandler(IRepository repository) 23 | { 24 | this.repository = repository; 25 | } 26 | 27 | public void Handle(CreatePerson command) 28 | { 29 | // create a new instance of the person aggregate using the name and address from the command 30 | Person person = Person.CreatePerson(command.Id, command.Name, command.Street, command.StreetNumber); 31 | 32 | repository.Save(person, Guid.NewGuid(), null); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sample.AppService/People/KillPersonCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Commands; 6 | using NanoMessageBus; 7 | using CommonDomain.Persistence; 8 | using Sample.DomainModel; 9 | using Sample.DomainModel.People; 10 | using Sample.Messages.Commands.People; 11 | 12 | namespace Sample.AppService.People 13 | { 14 | public class KillPersonCommandHandler : IHandleMessages 15 | { 16 | private readonly IRepository repository; 17 | 18 | public KillPersonCommandHandler(IRepository repository) 19 | { 20 | this.repository = repository; 21 | } 22 | 23 | public void Handle(KillPerson command) 24 | { 25 | Person person = repository.GetById(command.VictimId, int.MaxValue); 26 | 27 | person.Kill(); 28 | 29 | repository.Save(person, Guid.NewGuid(), null); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sample.AppService/People/MovePersonCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Commands; 6 | using NanoMessageBus; 7 | using CommonDomain.Persistence; 8 | using Sample.DomainModel; 9 | using Sample.DomainModel.People; 10 | using Sample.Messages.Commands.People; 11 | 12 | namespace Sample.AppService.People 13 | { 14 | /// 15 | /// Command handler for the MovePerson command. 16 | /// Finds the person aggregate by the Id and calls MoveToAddress() on it then saves 17 | /// the AR in the repository. 18 | /// 19 | public class MovePersonCommandHandler : IHandleMessages 20 | { 21 | private readonly IRepository repository; 22 | 23 | public MovePersonCommandHandler(IRepository repository) 24 | { 25 | this.repository = repository; 26 | } 27 | 28 | public void Handle(MovePerson command) 29 | { 30 | // Command Handlers should usualy keep it simple Get AR, Call Method on AR, Save AR 31 | 32 | // get by id 33 | Person person = repository.GetById(command.PersonId, int.MaxValue); 34 | 35 | // call method 36 | person.MoveToAddress(new Address(command.Street, command.StreetNumber)); 37 | 38 | // save 39 | repository.Save(person, Guid.NewGuid(), null); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sample.AppService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.AppService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.AppService")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cc78a197-d27e-487c-b15b-b3b36212abf9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.AppService/Sample.AppService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {34FF9205-40A2-467B-99B4-11C4DF5BC556} 9 | Library 10 | Properties 11 | Sample.AppService 12 | Sample.AppService 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\lib\CommonDomain\CommonDomain.dll 36 | 37 | 38 | ..\lib\NanoMessageBus\NanoMessageBus.dll 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {B6D748C5-8E02-49E7-AF1F-C161AF52EE60} 61 | Sample.DomainModel 62 | 63 | 64 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 65 | Sample.Messages 66 | 67 | 68 | 69 | 70 | 77 | -------------------------------------------------------------------------------- /Sample.AppServiceHost/BusConfigModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Autofac; 3 | using NanoMessageBus.Core; 4 | using NanoMessageBus.SubscriptionStorage; 5 | using NanoMessageBus.SubscriptionStorage.Raven; 6 | using NanoMessageBus.Wireup; 7 | using NanoMessageBus; 8 | using Raven.Client; 9 | using Raven.Client.Document; 10 | using Sample.AppService.Funds; 11 | using Sample.AppService.People; 12 | using Sample.Messages.Commands.Funds; 13 | using Sample.Messages.Commands.People; 14 | 15 | namespace Sample.AppServiceHost 16 | { 17 | class BusConfigModule : Module 18 | { 19 | protected override void Load(ContainerBuilder builder) 20 | { 21 | IWireup wireup = new WireupModule(); 22 | 23 | wireup = wireup.Configure() 24 | .UseLog4Net(); 25 | 26 | wireup = wireup.Configure() 27 | .ReceiveWith(1.Threads()); // number of threads to use for handlers 28 | 29 | wireup = wireup.Configure() 30 | .WithJsonSerializer() 31 | .CompressMessages(); 32 | 33 | wireup = wireup.Configure() 34 | .ListenOn("msmq://./Sample.AppService") 35 | .ForwardPoisonMessagesTo("msmq://./Sample.Error") 36 | .RetryAtLeast(3.Times()); 37 | 38 | IDocumentStore store = new DocumentStore() { ConnectionStringName = "SubscriptionStorage" }; 39 | store.Initialize(); 40 | // maybe register the store in the container? 41 | 42 | RavenSubscriptionStorage subscriptionStorage = new RavenSubscriptionStorage(store); 43 | 44 | builder.RegisterInstance(subscriptionStorage) 45 | .As() 46 | .SingleInstance() 47 | .ExternallyOwned(); 48 | 49 | wireup = wireup.Configure() 50 | .WithCustomSubscriptionStorage(subscriptionStorage); 51 | // .ConnectTo("SubscriptionStorage"); 52 | 53 | Type[] commandTypes = new Type[] { 54 | typeof(CreatePerson), 55 | typeof(MovePerson), 56 | typeof(KillPerson), 57 | typeof(CreateDocument), 58 | typeof(CreateShareClass), 59 | typeof(AssociateShareClassToDocument) 60 | }; 61 | 62 | wireup = wireup.Configure() 63 | .RegisterMessageEndpoint("msmq://./Sample.AppService", commandTypes) 64 | .RegisterMessageTimeToLive(TimeSpan.MaxValue, commandTypes) 65 | .RegisterTransientMessage(commandTypes); 66 | 67 | builder.RegisterType(); 68 | builder.RegisterType(); 69 | builder.RegisterType(); 70 | 71 | builder.RegisterType(); 72 | builder.RegisterType(); 73 | builder.RegisterType(); 74 | 75 | 76 | wireup = wireup.Configure() 77 | .AddHandler(c => c.Resolve()) 78 | .AddHandler(c => c.Resolve()) 79 | .AddHandler(c => c.Resolve()) 80 | .AddHandler(c => c.Resolve()) 81 | .AddHandler(c => c.Resolve()) 82 | .AddHandler(c => c.Resolve()); 83 | 84 | wireup.Register(builder); 85 | 86 | builder.RegisterType() 87 | .As() 88 | .InstancePerLifetimeScope() 89 | .ExternallyOwned(); 90 | 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Sample.AppServiceHost/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Autofac; 3 | using NanoMessageBus.Transports; 4 | using System.IO; 5 | 6 | namespace Sample.AppServiceHost 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | log4net.Config.XmlConfigurator.ConfigureAndWatch( new FileInfo(@"../../../log4net.xml")); 13 | 14 | var builder = new ContainerBuilder(); 15 | // configure NanoMessageBus 16 | builder.RegisterModule(new BusConfigModule()); 17 | // configure the EventStore 18 | builder.RegisterModule(new StorageConfigModule()); 19 | 20 | using (var container = builder.Build()) 21 | { 22 | // start waiting for commands. 23 | Console.WriteLine("AppService Listening..."); 24 | var transport = container.Resolve(); 25 | transport.StartListening(); 26 | 27 | Console.WriteLine("Waiting..."); 28 | Console.ReadKey(); 29 | transport.StopListening(); 30 | Console.WriteLine("Stopping..."); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sample.AppServiceHost/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.AppServiceHost")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.AppServiceHost")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7840ae13-1d87-47f1-a74f-508f5e4cf117")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.AppServiceHost/Sample.AppServiceHost.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {90E2153A-2E2A-4E1E-8D65-D5A34F7AE783} 9 | Exe 10 | Properties 11 | Sample.AppServiceHost 12 | Sample.AppServiceHost 13 | v4.0 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | x86 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | False 40 | ..\lib\Autofac\Autofac.dll 41 | 42 | 43 | False 44 | ..\lib\CommonDomain\CommonDomain.dll 45 | 46 | 47 | ..\lib\EventStore\EventStore.dll 48 | 49 | 50 | False 51 | ..\lib\EventStore\persistence\raven\EventStore.Persistence.RavenPersistence.dll 52 | 53 | 54 | False 55 | ..\lib\log4net\log4net.dll 56 | 57 | 58 | ..\lib\NanoMessageBus\NanoMessageBus.dll 59 | 60 | 61 | ..\lib\NanoMessageBus\Serialization\Json.Net\NanoMessageBus.Serialization.Json.dll 62 | 63 | 64 | False 65 | ..\lib\NanoMessageBus\SubscriptionStorage\Raven\NanoMessageBus.SubscriptionStorage.Raven.dll 66 | 67 | 68 | ..\lib\Newtonsoft.Json\Newtonsoft.Json.dll 69 | 70 | 71 | ..\lib\RavenDB\.NET 4.0\Raven.Client.Lightweight.dll 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | {34FF9205-40A2-467B-99B4-11C4DF5BC556} 90 | Sample.AppService 91 | 92 | 93 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 94 | Sample.Messages 95 | 96 | 97 | 98 | 99 | Designer 100 | 101 | 102 | 103 | 110 | -------------------------------------------------------------------------------- /Sample.AppServiceHost/StorageConfigModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Autofac; 6 | using CommonDomain.Core; 7 | using CommonDomain.Persistence.EventStore; 8 | using Sample.AppService; 9 | using CommonDomain; 10 | using CommonDomain.Persistence; 11 | using EventStore; 12 | using EventStore.Persistence; 13 | using EventStore.Persistence.SqlPersistence; 14 | using EventStore.Persistence.SqlPersistence.SqlDialects; 15 | using EventStore.Serialization; 16 | using EventStore.Dispatcher; 17 | using NanoMessageBus.Core; 18 | 19 | namespace Sample.AppServiceHost 20 | { 21 | class StorageConfigModule : Module 22 | { 23 | protected override void Load(ContainerBuilder builder) 24 | { 25 | builder.Register(c => BuildEventStore(c.Resolve())) 26 | .As() 27 | .SingleInstance(); 28 | 29 | builder.RegisterType().As(); 30 | builder.RegisterType().As(); 31 | builder.RegisterType().As(); 32 | } 33 | 34 | private static IStoreEvents BuildEventStore(ILifetimeScope container) 35 | { 36 | return EventStore.Wireup.Init() 37 | // use RavenDb to store events 38 | .UsingRavenPersistence("EventStore") 39 | 40 | // OR use SQL to store events 41 | //.UsingSqlPersistence("EventStore") 42 | // .InitializeStorageEngine() 43 | 44 | // Serialization is only needed for SQL since raven has it's own serializer 45 | //.UsingJsonSerialization() 46 | //.Compress() 47 | 48 | .UsingAsynchronousDispatcher() 49 | .PublishTo(new DelegateMessagePublisher(c => DispatchCommit(container, c))) 50 | .Build(); 51 | } 52 | 53 | private static void DispatchCommit(ILifetimeScope container, Commit commit) 54 | { 55 | using (var scope = container.BeginLifetimeScope()) 56 | { 57 | NanoMessageBus.IPublishMessages publisher = scope.Resolve(); 58 | 59 | publisher.Publish(commit.Events.Select(e => e.Body).ToArray()); 60 | 61 | // need to complete and dispose the uow to do the actual publishing since 62 | // the IHandleUnitOfWork is registered as ExternalyOwned 63 | using (IHandleUnitOfWork uow = scope.Resolve()) 64 | { 65 | uow.Complete(); 66 | } 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Sample.AppServiceHost/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Sample.Client.Web/BusConfigModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using Autofac; 6 | using NanoMessageBus.Wireup; 7 | using Sample.Messages.Commands; 8 | using NanoMessageBus.Core; 9 | using NanoMessageBus; 10 | using Autofac.Integration.Mvc; 11 | using Sample.Messages.Commands.People; 12 | using Sample.Messages.Commands.Funds; 13 | 14 | namespace Sample.Client.Web 15 | { 16 | public class BusConfigModule : Module 17 | { 18 | protected override void Load(ContainerBuilder builder) 19 | { 20 | IWireup wireup = new WireupModule(); 21 | 22 | wireup = wireup.Configure() 23 | .UseLog4Net(); 24 | 25 | wireup = wireup.Configure() 26 | .ReceiveWith(1.Threads()); 27 | 28 | wireup = wireup.Configure() 29 | .WithJsonSerializer() 30 | .CompressMessages(); 31 | 32 | wireup = wireup.Configure() 33 | .ListenOn("msmq://./Sample.Client") 34 | .ForwardPoisonMessagesTo("msmq://./Sample.Error") 35 | .RetryAtLeast(3.Times()); 36 | 37 | Type[] messageTypes = new Type[] { 38 | typeof(CreatePerson), 39 | typeof(MovePerson), 40 | typeof(KillPerson), 41 | typeof(CreateDocument), 42 | typeof(CreateShareClass), 43 | typeof(AssociateShareClassToDocument) 44 | }; 45 | 46 | 47 | wireup = wireup.Configure() 48 | .RegisterMessageEndpoint("msmq://./Sample.AppService", messageTypes ) 49 | .RegisterMessageTimeToLive(TimeSpan.MaxValue, messageTypes) 50 | .RegisterTransientMessage(messageTypes); 51 | 52 | wireup.Register(builder); 53 | 54 | 55 | builder.RegisterType() 56 | .As() 57 | .OnRelease(u => u.Complete()) 58 | .InstancePerHttpRequest() 59 | .OwnedByLifetimeScope(); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Sample.Client.Web/Content/Site.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | font-size: 75%; 4 | font-family: Verdana, Tahoma, Arial, "Helvetica Neue", Helvetica, Sans-Serif; 5 | color: #232323; 6 | background-color: #fff; 7 | } 8 | 9 | /* Styles for basic forms 10 | -----------------------------------------------------------*/ 11 | 12 | fieldset 13 | { 14 | border:1px solid #ddd; 15 | padding:0 1.4em 1.4em 1.4em; 16 | margin:0 0 1.5em 0; 17 | } 18 | 19 | legend 20 | { 21 | font-size:1.2em; 22 | font-weight: bold; 23 | } 24 | 25 | textarea 26 | { 27 | min-height: 75px; 28 | } 29 | 30 | .editor-label 31 | { 32 | margin: 1em 0 0 0; 33 | } 34 | 35 | .editor-field 36 | { 37 | margin:0.5em 0 0 0; 38 | } 39 | 40 | 41 | /* Styles for validation helpers 42 | -----------------------------------------------------------*/ 43 | .field-validation-error 44 | { 45 | color: #ff0000; 46 | } 47 | 48 | .field-validation-valid 49 | { 50 | display: none; 51 | } 52 | 53 | .input-validation-error 54 | { 55 | border: 1px solid #ff0000; 56 | background-color: #ffeeee; 57 | } 58 | 59 | .validation-summary-errors 60 | { 61 | font-weight: bold; 62 | color: #ff0000; 63 | } 64 | 65 | .validation-summary-valid 66 | { 67 | display: none; 68 | } 69 | -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /Sample.Client.Web/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/Sample.Client.Web/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /Sample.Client.Web/Controllers/FundsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using StorageAccess; 7 | using NanoMessageBus; 8 | using Sample.ReadModel.Funds; 9 | using Sample.Messages.Commands.Funds; 10 | using Sample.Client.Web.Models; 11 | using Sample.ReadModel; 12 | 13 | namespace Sample.Client.Web.Controllers 14 | { 15 | public class FundsController : Controller 16 | { 17 | private readonly IQueryStorage store; 18 | private readonly ISendMessages bus; 19 | 20 | public FundsController(IQueryStorage store, ISendMessages bus) 21 | { 22 | this.store = store; 23 | this.bus = bus; 24 | } 25 | 26 | [HttpGet] 27 | public ActionResult Index() 28 | { 29 | return View(); 30 | } 31 | 32 | [HttpGet] 33 | public ActionResult Documents() 34 | { 35 | return View(store.Items()); 36 | } 37 | 38 | [HttpGet] 39 | public ActionResult Shares() 40 | { 41 | return View(store.Items()); 42 | } 43 | 44 | [HttpGet] 45 | public ActionResult CreateDocument() 46 | { 47 | return View( new Document(Guid.NewGuid())); 48 | } 49 | 50 | [HttpPost] 51 | public ActionResult CreateDocument(Document document) 52 | { 53 | bus.Send(new CreateDocument(Guid.NewGuid(), document.AccessionNumber)); 54 | 55 | return RedirectToAction("Index"); 56 | } 57 | 58 | [HttpGet] 59 | public ActionResult CreateShare() 60 | { 61 | return View(new ShareClass(Guid.NewGuid())); 62 | } 63 | 64 | [HttpPost] 65 | public ActionResult CreateShare(ShareClass share) 66 | { 67 | if (share.Type != "Open" && share.Type != "Closed") 68 | { 69 | this.ModelState.AddModelError("Type", "Type must be Open or Closed"); 70 | return View(share); 71 | } 72 | 73 | bus.Send(new CreateShareClass(Guid.NewGuid(), share.Ticker, share.Type)); 74 | return RedirectToAction("Index"); 75 | } 76 | 77 | [HttpGet] 78 | public ActionResult Document(Guid id) 79 | { 80 | DocumentViewModel model = new DocumentViewModel 81 | { 82 | Document = store.Load(id), 83 | AllShares = store.Items() 84 | }; 85 | return View(model); 86 | } 87 | 88 | [HttpPost] 89 | public ActionResult AssociateShareClass(Guid share, Guid document) 90 | { 91 | ShareClass shareClass = store.Load(share); 92 | Document doc = store.Load(document); 93 | 94 | bus.Send(new AssociateShareClassToDocument(document, share, shareClass.Type)); 95 | return RedirectToAction("Document", new { id = document }); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Sample.Client.Web/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace Sample.Client.Web.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | // 12 | // GET: /Home/ 13 | 14 | public ActionResult Index() 15 | { 16 | return View(); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sample.Client.Web/Controllers/PersonController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using Sample.ReadModel; 7 | using Sample.Messages.Commands; 8 | using Sample.Messages; 9 | using NanoMessageBus; 10 | using StorageAccess; 11 | using NanoMessageBus.Core; 12 | using Sample.ReadModel.People; 13 | using Sample.Messages.Commands.People; 14 | 15 | namespace Sample.Client.Web.Controllers 16 | { 17 | public class PersonController : Controller 18 | { 19 | private readonly IQueryStorage store; 20 | private readonly ISendMessages bus; 21 | 22 | public PersonController(IQueryStorage store, ISendMessages bus) 23 | { 24 | this.store = store; 25 | this.bus = bus; 26 | } 27 | 28 | [HttpGet] 29 | public ActionResult Index() 30 | { 31 | IEnumerable persons = store.Items(); 32 | 33 | return View(persons); 34 | } 35 | 36 | [HttpGet] 37 | public ActionResult AddressChanges() 38 | { 39 | IEnumerable changes = store.Items(); 40 | return View(changes); 41 | } 42 | 43 | [HttpGet] 44 | public ActionResult Create() 45 | { 46 | Person person = new Person(Guid.NewGuid()); 47 | return View(person); 48 | } 49 | 50 | [HttpPost] 51 | public ActionResult Create(Person person) 52 | { 53 | CreatePerson command = new CreatePerson(Guid.NewGuid(), person.Name, person.Street, person.StreetNumber); 54 | bus.Send(command); 55 | return this.RedirectToAction("Index"); 56 | } 57 | 58 | [HttpGet] 59 | public ActionResult Move(Guid id) 60 | { 61 | Person person = store.Load(id); 62 | return View(person); 63 | } 64 | 65 | [HttpPost] 66 | public ActionResult Move(Person person) 67 | { 68 | MovePerson command = new MovePerson(person.AggregateId, person.Street, person.StreetNumber); 69 | bus.Send(command); 70 | return this.RedirectToAction("Index"); 71 | } 72 | 73 | [HttpGet] 74 | public ActionResult Kill(Guid id) 75 | { 76 | // it's not recommended to delete/nuke data using GET requests. 77 | // you should require the user to POST the id instead in real systems 78 | 79 | KillPerson command = new KillPerson(id); 80 | bus.Send(command); 81 | return this.RedirectToAction("Index"); 82 | } 83 | 84 | [HttpGet] 85 | public ActionResult DeadPersons() 86 | { 87 | IEnumerable persons = store.Items(); 88 | 89 | return View(persons); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Sample.Client.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Sample.Client.Web.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Sample.Client.Web/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Reflection; 3 | using System.Web.Mvc; 4 | using System.Web.Routing; 5 | using Autofac; 6 | using Autofac.Integration.Mvc; 7 | using Autofac.Integration.Web; 8 | 9 | namespace Sample.Client.Web 10 | { 11 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 12 | // visit http://go.microsoft.com/?LinkId=9394801 13 | 14 | public class MvcApplication : System.Web.HttpApplication, IContainerProviderAccessor 15 | { 16 | // Provider that holds the application container. 17 | static IContainerProvider containerProvider; 18 | 19 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 20 | { 21 | filters.Add(new HandleErrorAttribute()); 22 | } 23 | 24 | public static void RegisterRoutes(RouteCollection routes) 25 | { 26 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 27 | 28 | routes.MapRoute( 29 | "LandingPage", // Route name 30 | "{controller}", 31 | new { controller = "Home", action = "Index" }); 32 | 33 | routes.MapRoute( 34 | "Default", // Route name 35 | "{controller}.aspx/{action}/{id}", // URL with parameters 36 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 37 | ); 38 | 39 | } 40 | 41 | protected void Application_Start() 42 | { 43 | log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(@"../../../log4net.xml")); 44 | 45 | AreaRegistration.RegisterAllAreas(); 46 | 47 | RegisterGlobalFilters(GlobalFilters.Filters); 48 | RegisterRoutes(RouteTable.Routes); 49 | 50 | ContainerBuilder builder = new ContainerBuilder(); 51 | 52 | builder.RegisterModule(new BusConfigModule()); 53 | 54 | // use raven 55 | builder.RegisterModule(new RavenConfigModule()); 56 | 57 | // or use nhibernate 58 | // builder.RegisterModule(new NHibernateConfigModule()); 59 | 60 | builder.RegisterControllers(Assembly.GetExecutingAssembly()); 61 | 62 | containerProvider = new ContainerProvider(builder.Build()); 63 | 64 | DependencyResolver.SetResolver(new AutofacDependencyResolver(containerProvider.ApplicationContainer)); 65 | } 66 | 67 | // Instance property that will be used by Autofac HttpModules 68 | // to resolve and inject dependencies. 69 | public IContainerProvider ContainerProvider 70 | { 71 | get { return containerProvider; } 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /Sample.Client.Web/Models/DocumentViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using Sample.ReadModel.Funds; 6 | 7 | namespace Sample.Client.Web.Models 8 | { 9 | public class DocumentViewModel 10 | { 11 | public Document Document { get; set; } 12 | public IEnumerable AllShares { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Sample.Client.Web/NHibernateConfigModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Integration.Mvc; 3 | using NHibernate; 4 | using NHibernate.Cfg; 5 | using NHibernate.Tool.hbm2ddl; 6 | using Sample.ReadModel.People; 7 | using StorageAccess; 8 | using StorageAccess.NHibernate; 9 | 10 | namespace Sample.Client.Web 11 | { 12 | public class NHibernateConfigModule : Module 13 | { 14 | protected override void Load(ContainerBuilder builder) 15 | { 16 | // configure and register hibernate 17 | Configuration config = BuildConfiguration(); 18 | 19 | // keep the read model schema up 2 date - don't do this in production 20 | SchemaUpdate updater = new SchemaUpdate(config); 21 | updater.Execute(true, true); 22 | 23 | ISessionFactory factory = config.BuildSessionFactory(); 24 | builder.RegisterInstance(factory); 25 | 26 | builder.Register(c => factory.OpenSession()) 27 | .As() 28 | .InstancePerHttpRequest(); 29 | 30 | // IQueryStorage registration 31 | builder.RegisterType().As() 32 | .InstancePerHttpRequest(); 33 | } 34 | 35 | private Configuration BuildConfiguration() 36 | { 37 | Configuration cfg = new Configuration(); 38 | cfg.SessionFactoryName("Sample.ReadModel"); 39 | 40 | cfg.DataBaseIntegration(db => 41 | { 42 | db.Dialect(); 43 | db.Driver(); 44 | db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote; 45 | db.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ReadModel"].ConnectionString; 46 | db.AutoCommentSql = true; 47 | db.LogSqlInConsole = false; 48 | db.LogFormatedSql = true; 49 | db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'"; 50 | }); 51 | 52 | cfg.AddAssembly(typeof(Person).Assembly); 53 | 54 | return cfg; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Sample.Client.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.Client.Web")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.Client.Web")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9f1debe8-cbfc-4779-b88d-11a83fa22a9c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Sample.Client.Web/RavenConfigModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Integration.Mvc; 3 | using Raven.Client; 4 | using Raven.Client.Document; 5 | using StorageAccess; 6 | using StorageAccess.Raven; 7 | 8 | namespace Sample.Client.Web 9 | { 10 | public class RavenConfigModule : Module 11 | { 12 | protected override void Load(ContainerBuilder builder) 13 | { 14 | IDocumentStore store = new DocumentStore() { ConnectionStringName = "ReadModel" }; 15 | store.Initialize(); 16 | builder.RegisterInstance(store); 17 | 18 | builder.Register(c => store.OpenSession()) 19 | .As() 20 | .InstancePerLifetimeScope(); 21 | 22 | TypeWithIdStrategy.TypeSeparator = "-"; 23 | IIdStrategy strategy = new TypeWithIdStrategy(); 24 | 25 | // IQueryStorage registration 26 | builder.RegisterType().As() 27 | .OnActivated(r => r.Instance.IdStrategy = strategy) 28 | .InstancePerHttpRequest(); 29 | 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Sample.Client.Web/Sample.Client.Web.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ShowAllFiles 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | SpecificPage 13 | True 14 | False 15 | False 16 | False 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | False 26 | True 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Funds/CreateDocument.cshtml: -------------------------------------------------------------------------------- 1 | @model Sample.ReadModel.Funds.Document 2 | 3 | @{ 4 | ViewBag.Title = "CreateDocument"; 5 | } 6 | 7 |

CreateDocument

8 | 9 | @using (Html.BeginForm()) { 10 | @Html.ValidationSummary(true) 11 |
12 | Document 13 | 14 |
15 | @Html.LabelFor(model => model.AccessionNumber) 16 |
17 |
18 | @Html.EditorFor(model => model.AccessionNumber) 19 | @Html.ValidationMessageFor(model => model.AccessionNumber) 20 |
21 | 22 |

23 | 24 |

25 |
26 | } 27 | 28 |
29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | 32 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Funds/CreateShare.cshtml: -------------------------------------------------------------------------------- 1 | @model Sample.ReadModel.Funds.ShareClass 2 | 3 | @{ 4 | ViewBag.Title = "CreateShare"; 5 | } 6 | 7 |

CreateShare

8 | 9 | @using (Html.BeginForm()) { 10 | @Html.ValidationSummary(true) 11 |
12 | ShareClass 13 | 14 |
15 | @Html.LabelFor(model => model.Ticker) 16 |
17 |
18 | @Html.EditorFor(model => model.Ticker) 19 | @Html.ValidationMessageFor(model => model.Ticker) 20 |
21 | 22 |
23 | @Html.LabelFor(model => model.Type) 24 |
25 |
26 | @Html.EditorFor(model => model.Type) 27 | @Html.ValidationMessageFor(model => model.Type) 28 |
29 | 30 |

31 | 32 |

33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Funds/Document.cshtml: -------------------------------------------------------------------------------- 1 | @model Sample.Client.Web.Models.DocumentViewModel 2 | 3 | @{ 4 | ViewBag.Title = "Document"; 5 | } 6 | 7 |

Document

8 | 9 |
10 | Document 11 | 12 |
AccessionNumber
13 |
@Model.Document.AccessionNumber
14 | 15 | @foreach (var share in Model.Document.ShareClasses) 16 | { 17 |
Ticker
18 |
@share.Ticker
19 | } 20 |
21 |
22 | @using (Html.BeginForm("AssociateShareClass","Funds")) 23 | { 24 | @Html.ValidationSummary(true) 25 |
26 | Associate Share 27 | 28 | 34 |

35 | 36 |

37 |
38 | } 39 |
40 |

41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | 44 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Funds/Documents.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Documents"; 5 | } 6 | 7 |

Documents

8 | 9 |

10 | @Html.ActionLink("Create New", "CreateDocument") 11 |

12 | 13 | 14 | 15 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 28 | 29 | } 30 | 31 |
16 | AccessionNumber 17 |
23 | @Html.ActionLink("Details", "Document", new { id=item.AggregateId }) 24 | 26 | @item.AccessionNumber 27 |
32 | 33 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Funds/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Index"; 3 | } 4 | 5 |

Index

6 | 7 |
8 | @{ Html.RenderAction("Documents"); } 9 |
10 | 11 |
12 | @{ Html.RenderAction("Shares"); } 13 |
14 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Funds/Shares.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Shares"; 5 | } 6 | 7 |

Shares

8 | 9 |

10 | @Html.ActionLink("Create New", "CreateShare") 11 |

12 | 13 | 14 | 15 | 18 | 21 | 22 | 23 | @foreach (var item in Model) { 24 | 25 | 28 | 31 | 34 | 35 | } 36 | 37 |
16 | Ticker 17 | 19 | Type 20 |
26 | @Html.ActionLink("Edit", "Edit", new { id=item.Id }) | 27 | 29 | @item.Ticker 30 | 32 | @item.Type 33 |
38 | 39 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Index"; 3 | } 4 | 5 |

Index

6 | 7 |

@Html.ActionLink("Person Sample","Index","Person")

8 |

@Html.ActionLink("Funds Sample","Index","Funds")

-------------------------------------------------------------------------------- /Sample.Client.Web/Views/Person/AddressChanges.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "AddressChanges"; 5 | } 6 | 7 |

AddressChanges

8 | 9 | 10 | 11 | 12 | 15 | 18 | 21 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 40 | 41 | } 42 | 43 |
13 | OldStreet 14 | 16 | OldNumber 17 | 19 | NewStreet 20 | 22 | NewNumber 23 |
29 | @item.OldStreet 30 | 32 | @item.OldNumber 33 | 35 | @item.NewStreet 36 | 38 | @item.NewNumber 39 |
44 | 45 |
46 |
47 |

@Html.ActionLink("Back to Persons list", "Index")

48 |

@Html.ActionLink("Refresh List", "AddressChanges") (welcome to the beautiful world of eventual consistency)

49 |
50 |
-------------------------------------------------------------------------------- /Sample.Client.Web/Views/Person/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model Sample.ReadModel.People.Person 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create

8 | 9 | @using (Html.BeginForm()) { 10 | @Html.ValidationSummary(true) 11 |
12 | Person 13 | 14 |
15 | @Html.LabelFor(model => model.Name) 16 |
17 |
18 | @Html.EditorFor(model => model.Name) 19 | @Html.ValidationMessageFor(model => model.Name) 20 |
21 | 22 |
23 | @Html.LabelFor(model => model.Street) 24 |
25 |
26 | @Html.EditorFor(model => model.Street) 27 | @Html.ValidationMessageFor(model => model.Street) 28 |
29 | 30 |
31 | @Html.LabelFor(model => model.StreetNumber) 32 |
33 |
34 | @Html.EditorFor(model => model.StreetNumber) 35 | @Html.ValidationMessageFor(model => model.StreetNumber) 36 |
37 | 38 |

39 | 40 |

41 |
42 | } 43 | 44 |
45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | 48 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Person/DeadPersons.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "DeadPersons"; 5 | } 6 | 7 |

DeadPersons

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | @foreach (var item in Model) { 20 | 21 | 24 | 25 | } 26 | 27 |
15 | Name 16 |
22 | @item.Name 23 |
28 | 29 |
30 |

@Html.ActionLink("View Alive Persons", "Index")

31 |

@Html.ActionLink("View Address Changes", "AddressChanges")

32 |

@Html.ActionLink("Refresh List", "DeadPersons") (welcome to the beautiful world of eventual consistency)

33 |
34 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Person/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

@Html.ActionLink("Create New", "Create")

10 | 11 | 12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | @foreach (var item in Model) { 26 | 27 | 31 | 34 | 37 | 40 | 41 | } 42 | 43 |
15 | Name 16 | 18 | Street 19 | 21 | StreetNumber 22 |
28 | @Html.ActionLink("Move", "Move", new { id = item.AggregateId }) | 29 | @Html.ActionLink("Kill", "Kill", new { id = item.AggregateId }) | 30 | 32 | @item.Name 33 | 35 | @item.Street 36 | 38 | @item.StreetNumber 39 |
44 | 45 |
46 |

@Html.ActionLink("View Dead Persons", "DeadPersons")

47 |

@Html.ActionLink("View Address Changes", "AddressChanges")

48 |

@Html.ActionLink("Refresh List", "Index") (welcome to the beautiful world of eventual consistency)

49 |
50 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Person/Move.cshtml: -------------------------------------------------------------------------------- 1 | @model Sample.ReadModel.People.Person 2 | 3 | @{ 4 | ViewBag.Title = "Move"; 5 | } 6 | 7 |

Move

8 | 9 | @using (Html.BeginForm()) { 10 | @Html.ValidationSummary(true) 11 |
12 | Person 13 | 14 | @Html.HiddenFor(model => model.AggregateId) 15 | @Html.HiddenFor(model => model.Id) 16 | 17 |
18 | @Html.LabelFor(model => model.Name) 19 |
20 |
21 | @Html.DisplayFor(model => model.Name) 22 |
23 | 24 |
25 | @Html.LabelFor(model => model.Street) 26 |
27 |
28 | @Html.EditorFor(model => model.Street) 29 | @Html.ValidationMessageFor(model => model.Street) 30 |
31 | 32 |
33 | @Html.LabelFor(model => model.StreetNumber) 34 |
35 |
36 | @Html.EditorFor(model => model.StreetNumber) 37 | @Html.ValidationMessageFor(model => model.StreetNumber) 38 |
39 | 40 |

41 | 42 |

43 |
44 | } 45 | 46 |
47 | @Html.ActionLink("Back to List", "Index") 48 |
49 | 50 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | Error 9 | 10 | 11 |

12 | Sorry, an error occurred while processing your request. 13 |

14 | 15 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | @ViewBag.Title 5 | 6 | 7 | 8 | 9 | @RenderBody() 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Sample.Client.Web/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /Sample.Client.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Sample.Client.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Sample.Client.Web/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Sample.Denormalizer/Funds/DocumentUpdater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Events.Funds; 6 | using NanoMessageBus; 7 | using StorageAccess; 8 | using Sample.ReadModel.Funds; 9 | using Sample.ReadModel; 10 | 11 | namespace Sample.Denormalizer.Funds 12 | { 13 | public class DocumentUpdater : 14 | IHandleMessages, 15 | IHandleMessages 16 | { 17 | private readonly IUpdateStorage storage; 18 | 19 | public DocumentUpdater(IUpdateStorage storage) 20 | { 21 | this.storage = storage; 22 | } 23 | 24 | public void Handle(DocumentCreated message) 25 | { 26 | Document document = new Document(message.Id) 27 | { 28 | AccessionNumber = message.AccessionNumber, 29 | ShareClasses = new List() 30 | }; 31 | storage.Add(document); 32 | } 33 | 34 | public void Handle(DocumentAssociatedWithShareclass message) 35 | { 36 | Document document = storage.Load(message.DocumentId); 37 | 38 | document.ShareClasses.Add(new ShareClass(message.ShareClassId) 39 | { 40 | Type = message.ShareClassType, 41 | // TODO: not sure if this is the best option 42 | Ticker = storage.Load(message.ShareClassId).Ticker 43 | }); 44 | 45 | storage.Update(document); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Sample.Denormalizer/Funds/ShareClassUpdater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Events.Funds; 6 | using NanoMessageBus; 7 | using StorageAccess; 8 | using Sample.ReadModel.Funds; 9 | 10 | namespace Sample.Denormalizer.Funds 11 | { 12 | public class ShareClassUpdater : IHandleMessages 13 | { 14 | private readonly IUpdateStorage storage; 15 | 16 | public ShareClassUpdater(IUpdateStorage storage) 17 | { 18 | this.storage = storage; 19 | } 20 | 21 | public void Handle(ShareClassCreated message) 22 | { 23 | ShareClass share = new ShareClass(message.Id) 24 | { 25 | Ticker = message.Ticker, 26 | Type = message.Type 27 | }; 28 | 29 | storage.Add(share); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sample.Denormalizer/People/AddressChangesUpdater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Events; 6 | using NanoMessageBus; 7 | using StorageAccess; 8 | using Sample.ReadModel; 9 | using Sample.ReadModel.People; 10 | using Sample.Messages.Events.People; 11 | 12 | namespace Sample.Denormalizer.People 13 | { 14 | public class AddressChangesUpdater: IHandleMessages 15 | { 16 | private readonly IUpdateStorage storage; 17 | 18 | public AddressChangesUpdater(IUpdateStorage storage) 19 | { 20 | this.storage = storage; 21 | } 22 | 23 | public void Handle(PersonMoved message) 24 | { 25 | storage.Add(new AddressChanges(message.Id) 26 | { 27 | NewNumber = message.NewNumber, 28 | NewStreet = message.NewStreet, 29 | OldNumber = message.OldNumber, 30 | OldStreet = message.OldStreet 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sample.Denormalizer/People/PersonUpdater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages.Events; 6 | using NanoMessageBus; 7 | using StorageAccess; 8 | using Sample.ReadModel; 9 | using Sample.Messages; 10 | using Sample.ReadModel.People; 11 | using Sample.Messages.Events.People; 12 | 13 | namespace Sample.Denormalizer.People 14 | { 15 | /// 16 | /// Event handler for the events published by a Person Aggregate from the Domain Model. 17 | /// Updates the read model using the read storage. 18 | /// 19 | public class PersonUpdater : 20 | IHandleMessages, 21 | IHandleMessages, 22 | IHandleMessages 23 | { 24 | private readonly IUpdateStorage storage; 25 | 26 | public PersonUpdater(IUpdateStorage storage) 27 | { 28 | this.storage = storage; 29 | } 30 | 31 | public void Handle(PersonCreated message) 32 | { 33 | Person person = new Person(message.Id) 34 | { 35 | Name = message.Name, 36 | Street = message.Street, 37 | StreetNumber = message.StreetNumber 38 | }; 39 | storage.Add(person); 40 | } 41 | 42 | public void Handle(PersonMoved message) 43 | { 44 | Person person = storage.Load(message.Id); 45 | 46 | person.Street = message.NewStreet; 47 | person.StreetNumber = message.NewNumber; 48 | 49 | storage.Update(person); 50 | } 51 | 52 | 53 | public void Handle(PersonDied message) 54 | { 55 | Person person = storage.Load(message.Id); 56 | 57 | DeadPerson deadPerson = new DeadPerson(person.AggregateId) 58 | { 59 | Name = person.Name 60 | }; 61 | 62 | storage.Remove(person); 63 | storage.Add(deadPerson); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Sample.Denormalizer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.Denormalizer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.Denormalizer")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3484b576-2eb2-4537-bab4-009e5d728c49")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.Denormalizer/Sample.Denormalizer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {7457A692-33BC-4BD3-B4D9-3B3D980A57A5} 9 | Library 10 | Properties 11 | Sample.Denormalizer 12 | Sample.Denormalizer 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\lib\NanoMessageBus\NanoMessageBus.dll 36 | 37 | 38 | False 39 | ..\lib\StorageAccess\StorageAccess.dll 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 59 | Sample.Messages 60 | 61 | 62 | {4A556F82-6D67-43A4-902C-884EB52AB350} 63 | Sample.ReadModel 64 | 65 | 66 | 67 | 74 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/BusConfigModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Autofac; 6 | using NanoMessageBus.Wireup; 7 | using Sample.Messages.Events; 8 | using Sample.Denormalizer; 9 | using NanoMessageBus; 10 | using Sample.Messages.Commands; 11 | using Sample.Messages; 12 | using Sample.Denormalizer.People; 13 | using Sample.Messages.Events.People; 14 | using Sample.Messages.Events.Funds; 15 | using Sample.Denormalizer.Funds; 16 | 17 | namespace Sample.DenormalizerHost 18 | { 19 | class BusConfigModule : Module 20 | { 21 | protected override void Load(ContainerBuilder builder) 22 | { 23 | IWireup wireup = new WireupModule(); 24 | 25 | wireup = wireup.Configure() 26 | .UseLog4Net(); 27 | 28 | wireup = wireup.Configure() 29 | .ReceiveWith(1.Threads()); 30 | 31 | wireup = wireup.Configure() 32 | .WithJsonSerializer() 33 | .CompressMessages(); 34 | 35 | wireup = wireup.Configure() 36 | .ListenOn("msmq://./Sample.Denormalizer") 37 | .ForwardPoisonMessagesTo("msmq://./Sample.Error") 38 | .RetryAtLeast(3.Times()); 39 | 40 | wireup = wireup.Configure() 41 | .AddSubscription("msmq://./Sample.AppService", 42 | typeof(PersonCreated), typeof(PersonMoved), typeof(PersonDied), 43 | typeof(DocumentCreated), typeof(ShareClassCreated), typeof(DocumentAssociatedWithShareclass)); 44 | 45 | builder.RegisterType(); 46 | builder.RegisterType(); 47 | 48 | builder.RegisterType(); 49 | builder.RegisterType(); 50 | 51 | wireup = wireup.Configure() 52 | .AddHandler(c => c.Resolve()) 53 | .AddHandler(c => c.Resolve()) 54 | .AddHandler(c => c.Resolve()) 55 | .AddHandler(c => c.Resolve()) 56 | .AddHandler(c => c.Resolve()) 57 | .AddHandler(c => c.Resolve()) 58 | .AddHandler(c => c.Resolve()); 59 | 60 | 61 | wireup.Register(builder); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/NHibernateStorageConfigModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Autofac; 6 | using NHibernate.Cfg; 7 | using NHibernate; 8 | using Sample.ReadModel.NHibernatePersistence; 9 | using StorageAccess.NHibernate; 10 | using StorageAccess; 11 | 12 | namespace Sample.DenormalizerHost 13 | { 14 | public class NHibernateStorageConfigModule : Module 15 | { 16 | protected override void Load(ContainerBuilder builder) 17 | { 18 | Configuration config = BuildConfiguration(); 19 | ISessionFactory factory = config.BuildSessionFactory(); 20 | builder.RegisterInstance(factory); 21 | 22 | builder.Register(c => factory.OpenSession()) 23 | .As() 24 | .InstancePerDependency() 25 | .OnActivated(c => c.Instance.BeginTransaction()); 26 | 27 | builder.RegisterType().As() 28 | .InstancePerDependency(); 29 | } 30 | 31 | private static Configuration BuildConfiguration() 32 | { 33 | Configuration cfg = new Configuration(); 34 | cfg.SessionFactoryName("Sample.ReadModel"); 35 | 36 | cfg.DataBaseIntegration(db => 37 | { 38 | db.Dialect(); 39 | db.Driver(); 40 | db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote; 41 | db.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ReadModel"].ConnectionString; 42 | db.AutoCommentSql = true; 43 | db.LogSqlInConsole = false; 44 | db.LogFormatedSql = true; 45 | db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'"; 46 | }); 47 | 48 | cfg.AddAssembly(typeof(NHibernateMappings).Assembly); 49 | 50 | return cfg; 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Autofac; 3 | using NanoMessageBus.Transports; 4 | using System.IO; 5 | using Sample.ReadModel.People; 6 | using Raven.Client; 7 | using System.Linq; 8 | using Sample.ReadModel; 9 | 10 | namespace Sample.DenormalizerHost 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(@"../../../log4net.xml")); 17 | 18 | var builder = new ContainerBuilder(); 19 | builder.RegisterModule(new BusConfigModule()); 20 | 21 | // use ravendb 22 | builder.RegisterModule(new RavenStorageConfigModule()); 23 | 24 | // or use nhibernte 25 | //builder.RegisterModule(new NHibernateStorageConfigModule()); 26 | 27 | using (var container = builder.Build()) 28 | { 29 | Console.WriteLine("Denormalizer Listening..."); 30 | var transport = container.Resolve(); 31 | transport.StartListening(); 32 | 33 | Console.WriteLine("Waiting..."); 34 | Console.ReadKey(); 35 | Console.WriteLine("Stopping..."); 36 | transport.StopListening(); 37 | } 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.DenormalizerHost")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.DenormalizerHost")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e60a670d-c6ef-4d35-b304-3ac499e1c780")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/RavenStorageConfigModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Autofac; 6 | using StorageAccess; 7 | using Sample.ReadModel; 8 | using Sample.ReadModel.People; 9 | 10 | using Raven.Client; 11 | using Raven.Client.Document; 12 | using StorageAccess.Raven; 13 | 14 | namespace Sample.DenormalizerHost 15 | { 16 | public class RavenStorageConfigModule : Module 17 | { 18 | protected override void Load(ContainerBuilder builder) 19 | { 20 | IDocumentStore store = new DocumentStore() { ConnectionStringName = "ReadModel" }; 21 | store.Initialize(); 22 | 23 | builder.RegisterInstance(store); 24 | 25 | builder.Register(c => store.OpenSession()) 26 | .As() 27 | .InstancePerLifetimeScope(); 28 | 29 | TypeWithIdStrategy.TypeSeparator = "-"; 30 | IIdStrategy strategy = new TypeWithIdStrategy(); 31 | 32 | builder.RegisterType().As() 33 | .OnActivated(r => r.Instance.IdStrategy = strategy) 34 | .InstancePerDependency(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/Sample.DenormalizerHost.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {C5AD4F0A-51E6-4C11-BF07-C9D748E99CCC} 9 | Exe 10 | Properties 11 | Sample.DenormalizerHost 12 | Sample.DenormalizerHost 13 | v4.0 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | x86 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | False 40 | ..\lib\Autofac\Autofac.dll 41 | 42 | 43 | False 44 | ..\lib\log4net\log4net.dll 45 | 46 | 47 | ..\lib\NanoMessageBus\NanoMessageBus.dll 48 | 49 | 50 | ..\lib\NanoMessageBus\Serialization\Json.Net\NanoMessageBus.Serialization.Json.dll 51 | 52 | 53 | ..\lib\Newtonsoft.Json\Newtonsoft.Json.dll 54 | 55 | 56 | ..\lib\NHibernate\NHibernate.dll 57 | 58 | 59 | ..\lib\RavenDB\.NET 4.0\Raven.Abstractions.dll 60 | 61 | 62 | ..\lib\RavenDB\.NET 4.0\Raven.Client.Lightweight.dll 63 | 64 | 65 | ..\lib\StorageAccess\StorageAccess.dll 66 | 67 | 68 | ..\lib\StorageAccess\StorageAccess.NHibernate.dll 69 | 70 | 71 | ..\lib\StorageAccess\StorageAccess.Raven.dll 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | {7457A692-33BC-4BD3-B4D9-3B3D980A57A5} 92 | Sample.Denormalizer 93 | 94 | 95 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 96 | Sample.Messages 97 | 98 | 99 | {4991E942-B9A8-466A-A6A3-C881BFE3139E} 100 | Sample.ReadModel.NHibernatePersistence 101 | 102 | 103 | {4A556F82-6D67-43A4-902C-884EB52AB350} 104 | Sample.ReadModel 105 | 106 | 107 | 108 | 109 | 110 | 111 | 118 | -------------------------------------------------------------------------------- /Sample.DenormalizerHost/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sample.DomainModel/Funds/AccessionNumber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.DomainModel.Funds 7 | { 8 | public class AccessionNumber 9 | { 10 | public AccessionNumber(string value) 11 | { 12 | this.Value = value; 13 | } 14 | 15 | public string Value { get; private set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sample.DomainModel/Funds/Document.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages; 6 | using CommonDomain.Core; 7 | using Sample.Messages.Events.Funds; 8 | 9 | namespace Sample.DomainModel.Funds 10 | { 11 | public class Document : AggregateBase 12 | { 13 | private AccessionNumber accessionNumber; 14 | private IList shareClassAssociations = new List(); 15 | 16 | private Document(Guid id) 17 | { 18 | this.Id = id; 19 | } 20 | 21 | public Document(Guid id, AccessionNumber accessionNumber) 22 | :this(id) 23 | { 24 | RaiseEvent(new DocumentCreated(id, accessionNumber.Value)); 25 | } 26 | 27 | public void AssociateWithShareClass(DocumentShareClassAssociation association) 28 | { 29 | if (!association.ShareType.IsLinkable) 30 | { 31 | throw new InvalidOperationException("Only linkable share classes can be associated with documents"); 32 | } 33 | 34 | RaiseEvent(new DocumentAssociatedWithShareclass(this.Id, association.ShareClassId, association.ShareType.Name.ToString())); 35 | } 36 | 37 | private void Apply(DocumentCreated @event) 38 | { 39 | this.accessionNumber = new AccessionNumber(@event.AccessionNumber); 40 | } 41 | 42 | private void Apply(DocumentAssociatedWithShareclass @event) 43 | { 44 | this.shareClassAssociations.Add( 45 | new DocumentShareClassAssociation(@event.DocumentId, @event.ShareClassId, 46 | ShareClassType.CreateFromString(@event.ShareClassType))); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sample.DomainModel/Funds/DocumentShareClassAssociation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.DomainModel.Funds 7 | { 8 | public class DocumentShareClassAssociation 9 | { 10 | public DocumentShareClassAssociation(Guid documentId, Guid shareClassId, ShareClassType shareClassType) 11 | { 12 | this.DocumentId = documentId; 13 | this.ShareClassId = shareClassId; 14 | this.ShareType = shareClassType; 15 | } 16 | 17 | public Guid DocumentId { get; private set; } 18 | public Guid ShareClassId { get; private set; } 19 | public ShareClassType ShareType { get; private set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.DomainModel/Funds/ShareClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.Messages; 6 | using CommonDomain.Core; 7 | using Sample.Messages.Events.Funds; 8 | 9 | namespace Sample.DomainModel.Funds 10 | { 11 | public class ShareClass : AggregateBase 12 | { 13 | private Ticker ticker; 14 | private ShareClassType type; 15 | 16 | private ShareClass(Guid id) 17 | { 18 | this.Id = id; 19 | } 20 | 21 | public ShareClass(Guid id, Ticker ticker, ShareClassType type) 22 | : this(id) 23 | { 24 | RaiseEvent(new ShareClassCreated(id, ticker.Symbol, type.Name.ToString())); 25 | } 26 | 27 | private void Apply(ShareClassCreated @event) 28 | { 29 | this.ticker = new Ticker(@event.Ticker); 30 | this.type = ShareClassType.CreateFromString(@event.Type); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Sample.DomainModel/Funds/ShareClassType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.DomainModel.Funds 7 | { 8 | public class ShareClassType 9 | { 10 | public enum TypeName 11 | { 12 | Open, 13 | Closed 14 | }; 15 | 16 | public ShareClassType(TypeName type) 17 | { 18 | this.Name = type; 19 | } 20 | 21 | public static ShareClassType CreateFromString(string typeName) 22 | { 23 | TypeName name = (TypeName)Enum.Parse(typeof(TypeName), typeName); 24 | return new ShareClassType(name); 25 | } 26 | 27 | public TypeName Name { get; private set; } 28 | 29 | public bool IsLinkable 30 | { 31 | get 32 | { 33 | return this.Name == TypeName.Open; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sample.DomainModel/Funds/Ticker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.DomainModel.Funds 7 | { 8 | public class Ticker 9 | { 10 | public Ticker(string symbol) 11 | { 12 | this.Symbol = symbol; 13 | } 14 | 15 | public string Symbol { get; private set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sample.DomainModel/People/Address.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.DomainModel.People 7 | { 8 | /// 9 | /// Value object representing an address. 10 | /// 11 | public class Address 12 | { 13 | public Address(string street, string number) 14 | { 15 | this.Street = street; 16 | this.Number = number; 17 | } 18 | 19 | public string Street { get; private set; } 20 | public string Number { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sample.DomainModel/People/Person.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CommonDomain.Core; 6 | using Sample.Messages; 7 | using Sample.Messages.Events; 8 | using Sample.Messages.Events.People; 9 | 10 | namespace Sample.DomainModel.People 11 | { 12 | /// 13 | /// Sample aggregate root in the domain. 14 | /// 15 | public class Person : AggregateBase 16 | { 17 | private PersonName name; 18 | private Address currentAddress; 19 | private bool isAlive; 20 | 21 | /// 22 | /// Infrastructure constructor. 23 | /// 24 | private Person(Guid id) 25 | { 26 | if (id == Guid.Empty) 27 | { 28 | throw new ArgumentException("id"); 29 | } 30 | 31 | this.Id = id; 32 | } 33 | 34 | /// 35 | /// Initializes a new instance of the class. 36 | /// 37 | /// The id. 38 | /// The name. 39 | /// The address. 40 | public Person(Guid id , PersonName name, Address address) 41 | { 42 | this.Id = id; 43 | // the event will be routed by convention to a method called ApplyEvent(type of event) 44 | RaiseEvent(new PersonCreated(id, name.Value,address.Street,address.Number)); 45 | } 46 | 47 | /// 48 | /// Factory method for creating person objects. 49 | /// 50 | public static Person CreatePerson(Guid id, string name, string street, string streetNumber) 51 | { 52 | // in some cases the creation process is best delegated to a factory method. 53 | return new Person(id, new PersonName(name), new Address(street, streetNumber)); 54 | } 55 | 56 | /// 57 | /// Moves this person to a new address. 58 | /// 59 | /// The new address. 60 | public void MoveToAddress(Address newAddress) 61 | { 62 | // TODO: maybe publish an event signaling the error instead of throwing 63 | 64 | if (!this.isAlive) 65 | { 66 | throw new InvalidOperationException("Dead persons can't move."); 67 | } 68 | 69 | if (newAddress == currentAddress) 70 | { 71 | throw new InvalidOperationException("The new address must be different from the current one."); 72 | } 73 | 74 | RaiseEvent(new PersonMoved(Id, currentAddress.Street, currentAddress.Number, newAddress.Street, newAddress.Number)); 75 | } 76 | 77 | /// 78 | /// Kills this person. 79 | /// 80 | public void Kill() 81 | { 82 | if (!this.isAlive) 83 | { 84 | throw new InvalidOperationException("Dead persons can't die again."); 85 | } 86 | 87 | RaiseEvent(new PersonDied(Id)); 88 | } 89 | 90 | /// 91 | /// Applies the event. This method can be called when an aggregate method does RaiseEvent or 92 | /// when the infrastructure loads the aggregate from the event stream. 93 | /// 94 | /// The @event. 95 | private void Apply(PersonCreated @event) 96 | { 97 | // in the apply event handlers we should only have property assignements 98 | this.name = new PersonName(@event.Name); 99 | this.currentAddress = new Address(@event.Street, @event.StreetNumber); 100 | this.isAlive = true; 101 | } 102 | 103 | private void Apply(PersonMoved @event) 104 | { 105 | this.currentAddress = new Address(@event.NewStreet, @event.NewNumber); 106 | } 107 | 108 | private void Apply(PersonDied @event) 109 | { 110 | this.isAlive = false; 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Sample.DomainModel/People/PersonName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.DomainModel.People 7 | { 8 | /// 9 | /// Value object representing the name of the person 10 | /// 11 | public class PersonName 12 | { 13 | public PersonName(string name) 14 | { 15 | this.Value = name; 16 | } 17 | 18 | public string Value { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sample.DomainModel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.DomainModel")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.DomainModel")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7694c5fb-fc20-4809-b345-7d58598fb63a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.DomainModel/Sample.DomainModel.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {B6D748C5-8E02-49E7-AF1F-C161AF52EE60} 9 | Library 10 | Properties 11 | Sample.DomainModel 12 | Sample.DomainModel 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\lib\CommonDomain\CommonDomain.dll 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 60 | Sample.Messages 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /Sample.Messages/Commands/Funds/AssociateShareClassToDocument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Commands.Funds 7 | { 8 | public sealed class AssociateShareClassToDocument 9 | { 10 | public readonly Guid DocumentId; 11 | public readonly Guid ShareClassId; 12 | public readonly string ShareClassType; 13 | 14 | public AssociateShareClassToDocument(Guid documentId, Guid shareClassId, string shareClassType) 15 | { 16 | this.DocumentId = documentId; 17 | this.ShareClassId = shareClassId; 18 | this.ShareClassType = shareClassType; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.Messages/Commands/Funds/CreateDocument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Commands.Funds 7 | { 8 | public sealed class CreateDocument 9 | { 10 | public readonly Guid Id; 11 | public readonly string AccessionNumber; 12 | 13 | public CreateDocument(Guid id, string accessionNumber) 14 | { 15 | this.Id = id; 16 | this.AccessionNumber = accessionNumber; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sample.Messages/Commands/Funds/CreateShareClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Commands.Funds 7 | { 8 | public sealed class CreateShareClass 9 | { 10 | public readonly Guid Id; 11 | public readonly string Ticker; 12 | public readonly string Type; 13 | 14 | public CreateShareClass(Guid id, string ticker, string type) 15 | { 16 | this.Id = id; 17 | this.Ticker = ticker; 18 | this.Type = type; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.Messages/Commands/People/CreatePerson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Commands.People 7 | { 8 | public sealed class CreatePerson 9 | { 10 | public readonly Guid Id; 11 | public readonly string Name; 12 | public readonly string Street; 13 | public readonly string StreetNumber; 14 | 15 | public CreatePerson(Guid id, string name, string street, string streetNumber) 16 | { 17 | this.Id = id; 18 | this.Name = name; 19 | this.Street = street; 20 | this.StreetNumber = streetNumber; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sample.Messages/Commands/People/KillPerson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Commands.People 7 | { 8 | public sealed class KillPerson 9 | { 10 | public readonly Guid VictimId; 11 | 12 | public KillPerson(Guid victimId) 13 | { 14 | this.VictimId = victimId; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sample.Messages/Commands/People/MovePerson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Commands.People 7 | { 8 | public sealed class MovePerson 9 | { 10 | public readonly Guid PersonId; 11 | public readonly string Street; 12 | public readonly string StreetNumber; 13 | 14 | public MovePerson(Guid personId, string street, string streetNumber) 15 | { 16 | this.PersonId = personId; 17 | this.Street = street; 18 | this.StreetNumber = streetNumber; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.Messages/Events/Funds/DocumentAssociatedWithShareclass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Events.Funds 7 | { 8 | public sealed class DocumentAssociatedWithShareclass : IEvent 9 | { 10 | public readonly Guid DocumentId; 11 | public readonly Guid ShareClassId; 12 | public readonly string ShareClassType; 13 | 14 | public DocumentAssociatedWithShareclass(Guid documentId, Guid shareClassId, string shareClassType) 15 | { 16 | this.DocumentId = documentId; 17 | this.ShareClassId = shareClassId; 18 | this.ShareClassType = shareClassType; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.Messages/Events/Funds/DocumentCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Events.Funds 7 | { 8 | public sealed class DocumentCreated : IEvent 9 | { 10 | public readonly Guid Id; 11 | public readonly string AccessionNumber; 12 | 13 | public DocumentCreated(Guid id, string accessionNumber) 14 | { 15 | this.Id = id; 16 | this.AccessionNumber = accessionNumber; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sample.Messages/Events/Funds/ShareClassCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Events.Funds 7 | { 8 | public sealed class ShareClassCreated : IEvent 9 | { 10 | public readonly Guid Id; 11 | public readonly string Ticker; 12 | public readonly string Type; 13 | 14 | public ShareClassCreated(Guid id, string ticker, string type) 15 | { 16 | this.Id = id; 17 | this.Ticker = ticker; 18 | this.Type = type; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.Messages/Events/People/PersonCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.Serialization; 6 | 7 | namespace Sample.Messages.Events.People 8 | { 9 | public sealed class PersonCreated : IEvent 10 | { 11 | public readonly Guid Id; 12 | public readonly string Name; 13 | public readonly string Street; 14 | public readonly string StreetNumber; 15 | 16 | public PersonCreated(Guid id, string name, string street, string streetNumber) 17 | { 18 | this.Id = id; 19 | this.Name = name; 20 | this.Street = street; 21 | this.StreetNumber = streetNumber; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sample.Messages/Events/People/PersonDied.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Events.People 7 | { 8 | public sealed class PersonDied : IEvent 9 | { 10 | public readonly Guid Id; 11 | 12 | public PersonDied(Guid id) 13 | { 14 | this.Id = id; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sample.Messages/Events/People/PersonMoved.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages.Events.People 7 | { 8 | public sealed class PersonMoved : IEvent 9 | { 10 | public readonly Guid Id; 11 | 12 | public readonly string OldStreet; 13 | public readonly string OldNumber; 14 | 15 | public readonly string NewStreet; 16 | public readonly string NewNumber; 17 | 18 | public PersonMoved(Guid id, string oldStreet, string oldNumber, string newStreet, string newNumber) 19 | { 20 | this.Id = id; 21 | this.OldStreet = oldStreet; 22 | this.OldNumber = oldNumber; 23 | this.NewStreet = newStreet; 24 | this.NewNumber = newNumber; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sample.Messages/IEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.Messages 7 | { 8 | public interface IEvent 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sample.Messages/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.Messages")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.Messages")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a27f23fb-3d99-43a1-b752-bdcbba4eaba9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.Messages/Sample.Messages.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 9 | Library 10 | Properties 11 | Sample.Messages 12 | Sample.Messages 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 68 | -------------------------------------------------------------------------------- /Sample.QueryService/IPersonQueryService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.ReadModel; 6 | 7 | namespace Sample.QueryService 8 | { 9 | public interface IPersonQueryService 10 | { 11 | IQueryable QueryPersons { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sample.QueryService/PersonQueryService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Sample.ReadModel; 6 | using StorageAccess; 7 | 8 | namespace Sample.QueryService 9 | { 10 | public class PersonQueryService : IPersonQueryService 11 | { 12 | private readonly IQueryStorage storage; 13 | 14 | public PersonQueryService(IQueryStorage storage) 15 | { 16 | this.storage = storage; 17 | } 18 | 19 | private IEnumerable FakeStore 20 | { 21 | get 22 | { 23 | yield return new Person { Id = Guid.NewGuid(), Name = "P1", Street = "S1", StreetNumber = "1" }; 24 | yield return new Person { Id = Guid.NewGuid(), Name = "P2", Street = "S2", StreetNumber = "2" }; 25 | yield return new Person { Id = Guid.NewGuid(), Name = "P3", Street = "S3", StreetNumber = "3" }; 26 | yield return new Person { Id = Guid.NewGuid(), Name = "P4", Street = "S4", StreetNumber = "4" }; 27 | yield return new Person { Id = Guid.NewGuid(), Name = "P5", Street = "S5", StreetNumber = "5" }; 28 | yield return new Person { Id = Guid.NewGuid(), Name = "P6", Street = "S6", StreetNumber = "6" }; 29 | } 30 | } 31 | 32 | public IQueryable QueryPersons 33 | { 34 | get 35 | { 36 | return storage.Items().AsQueryable(); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Sample.QueryService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.QueryService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.QueryService")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("13a22c83-d57f-473b-9a05-bdd59eb6e7e3")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.QueryService/Sample.QueryService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {585092DB-C7FA-41B0-98B6-21BFBCA857B5} 9 | Library 10 | Properties 11 | Sample.QueryService 12 | Sample.QueryService 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\lib\StorageAccess\StorageAccess.dll 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | {4A556F82-6D67-43A4-902C-884EB52AB350} 53 | Sample.ReadModel 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/NHibernateMappings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel.NHibernatePersistence 7 | { 8 | public class NHibernateMappings 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.ReadModel.NHibernatePersistence")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Sample.ReadModel.NHibernatePersistence")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ab0297b3-dd51-483d-b3fb-80bbcf05e466")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/Sample.ReadModel.NHibernatePersistence.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {4991E942-B9A8-466A-A6A3-C881BFE3139E} 9 | Library 10 | Properties 11 | Sample.ReadModel.NHibernatePersistence 12 | Sample.ReadModel.NHibernatePersistence 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Designer 49 | 50 | 51 | 52 | 53 | Designer 54 | 55 | 56 | 57 | 58 | Designer 59 | 60 | 61 | 62 | 63 | Designer 64 | 65 | 66 | 67 | 74 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/XmlMappings/Funds/Document.hbm.xml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/XmlMappings/Funds/ShareClass.hbm.xml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/XmlMappings/People/AddressChanges.hbm.xml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sample.ReadModel.NHibernatePersistence/XmlMappings/People/Person.hbm.xml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sample.ReadModel/Funds/Document.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel.Funds 7 | { 8 | public class Document : ReadModelEntity 9 | { 10 | public Document() { }// needed for asp.net model binder 11 | public Document(Guid id) : base(id) { } 12 | 13 | public string AccessionNumber { get; set; } 14 | public ICollection ShareClasses { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sample.ReadModel/Funds/ShareClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel.Funds 7 | { 8 | public class ShareClass : ReadModelEntity 9 | { 10 | public ShareClass() { } // needed for asp.net model binder 11 | 12 | public ShareClass(Guid id) : base(id) { } 13 | 14 | public string Ticker { get; set; } 15 | public string Type { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sample.ReadModel/People/AddressChanges.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel.People 7 | { 8 | public class AddressChanges : ReadModelEntity 9 | { 10 | public AddressChanges(Guid id) : base(id) { } 11 | 12 | public string OldStreet { get; set; } 13 | public string OldNumber { get; set; } 14 | public string NewStreet { get; set; } 15 | public string NewNumber { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sample.ReadModel/People/DeadPerson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel.People 7 | { 8 | public class DeadPerson : ReadModelEntity 9 | { 10 | public DeadPerson(Guid id) : base(id) { } 11 | 12 | public string Name { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Sample.ReadModel/People/Person.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel.People 7 | { 8 | /// 9 | /// Read Model object for displaying a Person. 10 | /// Denormalized form of the Aggregate in the DomainModel. 11 | /// 12 | public class Person : ReadModelEntity 13 | { 14 | public Person() { }// needed for asp.net model binder 15 | public Person(Guid id) : base(id) { } 16 | 17 | public string Name { get; set; } 18 | public string Street { get; set; } 19 | public string StreetNumber { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample.ReadModel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.ReadModel")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Recognos Romania")] 12 | [assembly: AssemblyProduct("Sample.ReadModel")] 13 | [assembly: AssemblyCopyright("Copyright © Recognos Romania 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8ec8ab2e-bbb2-4cca-a79f-3156816efb2c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.ReadModel/ReadModelEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sample.ReadModel 7 | { 8 | public abstract class ReadModelEntity 9 | { 10 | public string Id { get; private set; } 11 | 12 | public ReadModelEntity() { }// needed for asp.net model binder 13 | 14 | public ReadModelEntity(Guid id) 15 | { 16 | this.Id = MakeId(this.GetType(), id); 17 | this.AggregateId = id; 18 | } 19 | 20 | public Guid AggregateId { get; set; } 21 | 22 | private static string MakeId(Type type, Guid id) 23 | { 24 | return string.Concat(type.Name, "-", id); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sample.ReadModel/Sample.ReadModel.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {4A556F82-6D67-43A4-902C-884EB52AB350} 9 | Library 10 | Properties 11 | Sample.ReadModel 12 | Sample.ReadModel 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | -------------------------------------------------------------------------------- /Sample.Tests/MessagesSerializationTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Linq; 5 | using Gallio.Framework; 6 | using MbUnit.Framework; 7 | using MbUnit.Framework.ContractVerifiers; 8 | using System.Reflection; 9 | using Sample.Messages.Events.People; 10 | 11 | namespace Sample.Tests 12 | { 13 | [TestFixture] 14 | public class MessagesSerializationTests 15 | { 16 | /// 17 | /// Build the test suite dynamically to be able to se which type fails the tests. 18 | /// 19 | [StaticTestFactory] 20 | public static IEnumerable CreateTests() 21 | { 22 | // build suite 23 | TestSuite commandsSuite = new TestSuite("messages"); 24 | 25 | foreach (Type message in GetMessages()) 26 | { 27 | // build test case for each message type 28 | commandsSuite.Children.Add( BuildTestCase(message)); 29 | } 30 | yield return commandsSuite; 31 | } 32 | 33 | /// 34 | /// Verify the expectations on a message type. 35 | /// 36 | /// The message type to assert on. 37 | private static void TestType(Type type) 38 | { 39 | // get the fields of the type 40 | FieldInfo[] fields = type.GetFields(); 41 | 42 | // all fields must be public readonly 43 | Assert.IsTrue(fields.All(f => f.IsPublic && f.IsInitOnly), 44 | "All fields must be marked public readonly. Not conforming: {0}", 45 | fields.Where(f => !(f.IsPublic && f.IsInitOnly)).Select(f => f.Name).ToArray()); 46 | 47 | // get the constructors of the type 48 | ConstructorInfo[] constructors = type.GetConstructors(); 49 | 50 | // the type must have exactly one constructor 51 | Assert.Count(1, constructors, "The message type has {0} constructors and must have exactly 1", constructors.Count()); 52 | ConstructorInfo constructor = constructors.Single(); 53 | 54 | // get the parameters of the constructor 55 | ParameterInfo[] parameters = constructor.GetParameters(); 56 | 57 | // the parameter count must be exactly as the field count 58 | Assert.Count(fields.Count(), parameters, 59 | "The constructor parameter {0} count must be the same as the field count {1} .", parameters.Count(), fields.Count()); 60 | 61 | // get the names of the fields 62 | IEnumerable fieldNames = fields.Select(f => f.Name.ToLowerInvariant()); 63 | 64 | // get the names of the constructor parameters 65 | IEnumerable paramNames = parameters.Select(p => p.Name.ToLowerInvariant()); 66 | 67 | // assert they are the same 68 | Assert.AreElementsEqualIgnoringOrder(fieldNames, paramNames); 69 | } 70 | 71 | /// 72 | /// Get all the message types from the messages assembly 73 | /// 74 | private static IEnumerable GetMessages() 75 | { 76 | return typeof(Sample.Messages.IEvent).Assembly.GetTypes().Where(t => !t.IsAbstract && !t.IsInterface); 77 | } 78 | 79 | private static Test BuildTestCase(Type messge) 80 | { 81 | string name = string.Format("{0}.{1}", messge.Namespace.Replace(messge.Assembly.GetName().Name + ".", string.Empty), messge.Name); 82 | return new TestCase(name, () => TestType(messge)); 83 | } 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Sample.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Sample.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6c7aabcc-9a39-4274-8868-4595ba8904be")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample.Tests/Sample.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {EF3686FB-F1A4-4EFB-9038-CB7E1B954F23} 9 | Library 10 | Properties 11 | Sample.Tests 12 | Sample.Tests 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\lib\EventStore\EventStore.dll 36 | 37 | 38 | ..\lib\EventStore\EventStore.Serialization.Json.dll 39 | 40 | 41 | ..\lib\EventStore\EventStore.Serialization.ServiceStack.dll 42 | 43 | 44 | False 45 | ..\lib\gallio\Gallio.dll 46 | 47 | 48 | False 49 | ..\lib\gallio\MbUnit.dll 50 | 51 | 52 | ..\lib\NanoMessageBus\NanoMessageBus.dll 53 | 54 | 55 | ..\lib\Newtonsoft.Json\Newtonsoft.Json.dll 56 | 57 | 58 | ..\lib\protobuf-net\protobuf-net.dll 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | {D3FCBB10-881D-4647-90BE-C73C44AC4F09} 75 | Sample.Messages 76 | 77 | 78 | 79 | 86 | -------------------------------------------------------------------------------- /lib/Autofac/Autofac License.txt: -------------------------------------------------------------------------------- 1 | Autofac IoC Container 2 | Copyright (c) 2007-2010 Autofac Contributors 3 | http://code.google.com/p/autofac/wiki/Contributing 4 | 5 | Other software included in this distribution is owned and 6 | licensed separately, see the included license files for details. 7 | 8 | Permission is hereby granted, free of charge, to any person 9 | obtaining a copy of this software and associated documentation 10 | files (the "Software"), to deal in the Software without 11 | restriction, including without limitation the rights to use, 12 | copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the 14 | Software is furnished to do so, subject to the following 15 | conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /lib/Autofac/Autofac.Configuration.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.Configuration.dll -------------------------------------------------------------------------------- /lib/Autofac/Autofac.Integration.Mef.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.Integration.Mef.dll -------------------------------------------------------------------------------- /lib/Autofac/Autofac.Integration.Mvc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.Integration.Mvc.dll -------------------------------------------------------------------------------- /lib/Autofac/Autofac.Integration.Wcf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.Integration.Wcf.dll -------------------------------------------------------------------------------- /lib/Autofac/Autofac.Integration.Web.Mvc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.Integration.Web.Mvc.dll -------------------------------------------------------------------------------- /lib/Autofac/Autofac.Integration.Web.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.Integration.Web.dll -------------------------------------------------------------------------------- /lib/Autofac/Autofac.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Autofac/Autofac.dll -------------------------------------------------------------------------------- /lib/CommonDomain/CommonDomain.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/CommonDomain/CommonDomain.dll -------------------------------------------------------------------------------- /lib/CommonDomain/CommonDomain.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/CommonDomain/CommonDomain.pdb -------------------------------------------------------------------------------- /lib/CommonDomain/CommonDomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CommonDomain 5 | 6 | 7 | -------------------------------------------------------------------------------- /lib/EventStore/EventStore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/EventStore.dll -------------------------------------------------------------------------------- /lib/EventStore/EventStore.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/EventStore.pdb -------------------------------------------------------------------------------- /lib/EventStore/persistence/mongo/EventStore.Persistence.MongoPersistence.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/mongo/EventStore.Persistence.MongoPersistence.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/mongo/EventStore.Persistence.MongoPersistence.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/mongo/EventStore.Persistence.MongoPersistence.pdb -------------------------------------------------------------------------------- /lib/EventStore/persistence/mongo/License.txt: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2011 10gen Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | -------------------------------------------------------------------------------- /lib/EventStore/persistence/mongo/MongoDB.Bson.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/mongo/MongoDB.Bson.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/mongo/MongoDB.Driver.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/mongo/MongoDB.Driver.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/EventStore.Persistence.RavenPersistence.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/EventStore.Persistence.RavenPersistence.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/EventStore.Persistence.RavenPersistence.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/EventStore.Persistence.RavenPersistence.pdb -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/Json.NET License.txt: -------------------------------------------------------------------------------- 1 | License: 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/MissingBitsFromClientProfile.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/MissingBitsFromClientProfile.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/Raven.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/Raven.Abstractions.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/Raven.Client.Lightweight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/Raven.Client.Lightweight.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/Raven.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/persistence/raven/Raven.Json.dll -------------------------------------------------------------------------------- /lib/EventStore/persistence/raven/license.txt: -------------------------------------------------------------------------------- 1 | Raven DB - A Document Database for the .NET platfrom 2 | Copyright (C) 2010 Hibernating rhinos 3 | =================================================================== 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | 18 | =================================================================== 19 | 20 | FOSS License Exception 21 | =================================================================== 22 | 23 | What is the FOSS License Exception? 24 | 25 | This Free and Open Source Software ("FOSS") License Exception allows 26 | developers of FOSS applications to include RavenDB with their FOSS 27 | applications. RavenDB is typically licensed pursuant to version 3 28 | of the Affero General Public License ("AGPL"), but this exception permits 29 | distribution of RavenDB with a developer's FOSS applications licensed 30 | under the terms of another FOSS license listed below, even though such 31 | other FOSS license may be incompatible with the AGPL. 32 | 33 | The following terms and conditions describe the circumstances under which 34 | this FOSS License Exception applies. 35 | 36 | FOSS License Exception Terms and Conditions 37 | 38 | Definitions. 39 | * "Derivative Work" means a derivative work, as defined under applicable 40 | copyright law, formed entirely from the Program and one or more FOSS Applications. 41 | * "FOSS Application" means a free and open source software application distributed 42 | subject to a license approved by the Open Source Initiative (OSI) board. A list of 43 | applicable licenses appears at: http://www.opensource.org/licenses/category. 44 | * "FOSS Notice" means a notice placed by Hibernating Rhinos or the RavenDB author 45 | in a copy of the RavenDB library stating that such copy of the RavenDB library 46 | may be distributed under Hibernating Rhinos's or RavenDB's FOSS License Exception. 47 | * "Independent Work" means portions of the Derivative Work that are not derived 48 | from the Program and can reasonably be considered independent and separate works. 49 | * "Program" means a copy of Hibernating Rhinos's RavenDB library that contains a FOSS 50 | Notice. 51 | 52 | A FOSS application developer ("you" or "your") may distribute a Derivative Work provided 53 | that you and the Derivative Work meet all of the following conditions: 54 | 55 | * You obey the AGPL in all respects for the Program and all portions (including 56 | modifications) of the Program included in the Derivative Work (provided that this 57 | condition does not apply to Independent Works); 58 | * The Derivative Work does not include any work licensed under the AGPL other than 59 | the Program; 60 | * You distribute Independent Works subject to a license approved by the OSI which is 61 | listed in http://www.opensource.org/licenses/category; 62 | * You distribute Independent Works in object code or executable form with the complete 63 | corresponding machine-readable source code on the same medium and under the same 64 | FOSS license applying to the object code or executable forms; 65 | * All works that are aggregated with the Program or the Derivative Work on a medium or 66 | volume of storage are not derivative works of the Program, Derivative Work or FOSS 67 | Application, and must reasonably be considered independent and separate works. 68 | 69 | Hibernating Rhinos reserves all rights not expressly granted in these terms and conditions. 70 | If all of the above conditions are not met, then this FOSS License Exception does not 71 | apply to you or your Derivative Work. 72 | 73 | =================================================================== 74 | 75 | Commercial Licensing 76 | =================================================================== 77 | In addition to this license, RavenDB is offered under a commerical license. 78 | You can learn more about this option by contacting us using: 79 | http://hibernatingrhinos.com/contact -------------------------------------------------------------------------------- /lib/EventStore/serialization/RavenJson/EventStore.Serialization.RavenJson.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/serialization/RavenJson/EventStore.Serialization.RavenJson.dll -------------------------------------------------------------------------------- /lib/EventStore/serialization/RavenJson/EventStore.Serialization.RavenJson.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/serialization/RavenJson/EventStore.Serialization.RavenJson.pdb -------------------------------------------------------------------------------- /lib/EventStore/serialization/json-net/EventStore.Serialization.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/serialization/json-net/EventStore.Serialization.Json.dll -------------------------------------------------------------------------------- /lib/EventStore/serialization/json-net/EventStore.Serialization.Json.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/serialization/json-net/EventStore.Serialization.Json.pdb -------------------------------------------------------------------------------- /lib/EventStore/serialization/json-net/license.txt: -------------------------------------------------------------------------------- 1 | License: 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /lib/EventStore/serialization/servicestack/EventStore.Serialization.ServiceStack.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/serialization/servicestack/EventStore.Serialization.ServiceStack.dll -------------------------------------------------------------------------------- /lib/EventStore/serialization/servicestack/EventStore.Serialization.ServiceStack.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/EventStore/serialization/servicestack/EventStore.Serialization.ServiceStack.pdb -------------------------------------------------------------------------------- /lib/EventStore/serialization/servicestack/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2011, Demis Bellot, ServiceStack. 2 | http://www.servicestack.net 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the ServiceStack nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /lib/NHibernate/Iesi.Collections.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NHibernate/Iesi.Collections.dll -------------------------------------------------------------------------------- /lib/NHibernate/Iesi.Collections.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NHibernate/Iesi.Collections.pdb -------------------------------------------------------------------------------- /lib/NHibernate/NHibernate.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NHibernate/NHibernate.dll -------------------------------------------------------------------------------- /lib/NHibernate/NHibernate.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NHibernate/NHibernate.pdb -------------------------------------------------------------------------------- /lib/NanoMessageBus/Autofac.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/Autofac.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/NLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/NLog.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/NanoMessageBus.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/NanoMessageBus.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/NanoMessageBus.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/NanoMessageBus.pdb -------------------------------------------------------------------------------- /lib/NanoMessageBus/Serialization/Json.Net/NanoMessageBus.Serialization.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/Serialization/Json.Net/NanoMessageBus.Serialization.Json.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/Serialization/Json.Net/NanoMessageBus.Serialization.Json.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/Serialization/Json.Net/NanoMessageBus.Serialization.Json.pdb -------------------------------------------------------------------------------- /lib/NanoMessageBus/Serialization/ProtocolBuffers.Net/NanoMessageBus.Serialization.ProtocolBuffers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/Serialization/ProtocolBuffers.Net/NanoMessageBus.Serialization.ProtocolBuffers.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/Serialization/ProtocolBuffers.Net/NanoMessageBus.Serialization.ProtocolBuffers.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/Serialization/ProtocolBuffers.Net/NanoMessageBus.Serialization.ProtocolBuffers.pdb -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Subscriptions 2 | ( 3 | Subscriber varchar(255) NOT NULL CHECK ( LEN(Subscriber) > 0 ), 4 | MessageType varchar(255) NOT NULL CHECK ( LEN(MessageType) > 0 ), 5 | Expiration smalldatetime NULL, 6 | CONSTRAINT PK_Subscribers PRIMARY KEY CLUSTERED ( Subscriber, MessageType ) 7 | ); 8 | CREATE UNIQUE NONCLUSTERED INDEX IX_Subscriptions ON Subscriptions 9 | ( 10 | MessageType, 11 | Expiration, 12 | Subscriber 13 | ); -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage/Raven/AsyncCtpLibrary.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/SubscriptionStorage/Raven/AsyncCtpLibrary.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage/Raven/MissingBitsFromClientProfile.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/SubscriptionStorage/Raven/MissingBitsFromClientProfile.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage/Raven/NanoMessageBus.SubscriptionStorage.Raven.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/SubscriptionStorage/Raven/NanoMessageBus.SubscriptionStorage.Raven.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage/Raven/NanoMessageBus.SubscriptionStorage.Raven.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/SubscriptionStorage/Raven/NanoMessageBus.SubscriptionStorage.Raven.pdb -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage/Raven/Raven.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/SubscriptionStorage/Raven/Raven.Abstractions.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/SubscriptionStorage/Raven/Raven.Client.Lightweight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/SubscriptionStorage/Raven/Raven.Client.Lightweight.dll -------------------------------------------------------------------------------- /lib/NanoMessageBus/log4net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/NanoMessageBus/log4net.dll -------------------------------------------------------------------------------- /lib/Newtonsoft.Json/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Newtonsoft.Json/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /lib/Newtonsoft.Json/Newtonsoft.Json.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/Newtonsoft.Json/Newtonsoft.Json.pdb -------------------------------------------------------------------------------- /lib/RavenDB/.NET 3.5/MissingBitsFromClientProfile.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 3.5/MissingBitsFromClientProfile.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 3.5/Newtonsoft.Json.Net35.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 3.5/Newtonsoft.Json.Net35.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 3.5/Raven.Abstractions-3.5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 3.5/Raven.Abstractions-3.5.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 3.5/Raven.Client.Lightweight-3.5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 3.5/Raven.Client.Lightweight-3.5.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 3.5/Raven.Json-3.5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 3.5/Raven.Json-3.5.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 4.0/AsyncCtpLibrary.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 4.0/AsyncCtpLibrary.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 4.0/MissingBitsFromClientProfile.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 4.0/MissingBitsFromClientProfile.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 4.0/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 4.0/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 4.0/Raven.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 4.0/Raven.Abstractions.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 4.0/Raven.Client.Lightweight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 4.0/Raven.Client.Lightweight.dll -------------------------------------------------------------------------------- /lib/RavenDB/.NET 4.0/Raven.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/RavenDB/.NET 4.0/Raven.Json.dll -------------------------------------------------------------------------------- /lib/RavenDB/license.txt: -------------------------------------------------------------------------------- 1 | Raven DB - A Document Database for the .NET platfrom 2 | Copyright (C) 2010 Hibernating rhinos 3 | =================================================================== 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | 18 | =================================================================== 19 | 20 | FOSS License Exception 21 | =================================================================== 22 | 23 | What is the FOSS License Exception? 24 | 25 | This Free and Open Source Software ("FOSS") License Exception allows 26 | developers of FOSS applications to include RavenDB with their FOSS 27 | applications. RavenDB is typically licensed pursuant to version 3 28 | of the Affero General Public License ("AGPL"), but this exception permits 29 | distribution of RavenDB with a developer's FOSS applications licensed 30 | under the terms of another FOSS license listed below, even though such 31 | other FOSS license may be incompatible with the AGPL. 32 | 33 | The following terms and conditions describe the circumstances under which 34 | this FOSS License Exception applies. 35 | 36 | FOSS License Exception Terms and Conditions 37 | 38 | Definitions. 39 | * "Derivative Work" means a derivative work, as defined under applicable 40 | copyright law, formed entirely from the Program and one or more FOSS Applications. 41 | * "FOSS Application" means a free and open source software application distributed 42 | subject to a license approved by the Open Source Initiative (OSI) board. A list of 43 | applicable licenses appears at: http://www.opensource.org/licenses/category. 44 | * "FOSS Notice" means a notice placed by Hibernating Rhinos or the RavenDB author 45 | in a copy of the RavenDB library stating that such copy of the RavenDB library 46 | may be distributed under Hibernating Rhinos's or RavenDB's FOSS License Exception. 47 | * "Independent Work" means portions of the Derivative Work that are not derived 48 | from the Program and can reasonably be considered independent and separate works. 49 | * "Program" means a copy of Hibernating Rhinos's RavenDB library that contains a FOSS 50 | Notice. 51 | 52 | A FOSS application developer ("you" or "your") may distribute a Derivative Work provided 53 | that you and the Derivative Work meet all of the following conditions: 54 | 55 | * You obey the AGPL in all respects for the Program and all portions (including 56 | modifications) of the Program included in the Derivative Work (provided that this 57 | condition does not apply to Independent Works); 58 | * The Derivative Work does not include any work licensed under the AGPL other than 59 | the Program; 60 | * You distribute Independent Works subject to a license approved by the OSI which is 61 | listed in http://www.opensource.org/licenses/category; 62 | * You distribute Independent Works in object code or executable form with the complete 63 | corresponding machine-readable source code on the same medium and under the same 64 | FOSS license applying to the object code or executable forms; 65 | * All works that are aggregated with the Program or the Derivative Work on a medium or 66 | volume of storage are not derivative works of the Program, Derivative Work or FOSS 67 | Application, and must reasonably be considered independent and separate works. 68 | 69 | Hibernating Rhinos reserves all rights not expressly granted in these terms and conditions. 70 | If all of the above conditions are not met, then this FOSS License Exception does not 71 | apply to you or your Derivative Work. 72 | 73 | =================================================================== 74 | 75 | Commercial Licensing 76 | =================================================================== 77 | In addition to this license, RavenDB is offered under a commerical license. 78 | You can learn more about this option by contacting us using: 79 | http://hibernatingrhinos.com/contact -------------------------------------------------------------------------------- /lib/StorageAccess/StorageAccess.NHibernate.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/StorageAccess/StorageAccess.NHibernate.dll -------------------------------------------------------------------------------- /lib/StorageAccess/StorageAccess.Raven.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/StorageAccess/StorageAccess.Raven.dll -------------------------------------------------------------------------------- /lib/StorageAccess/StorageAccess.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/StorageAccess/StorageAccess.dll -------------------------------------------------------------------------------- /lib/gallio/Gallio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/gallio/Gallio.dll -------------------------------------------------------------------------------- /lib/gallio/Gallio.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/gallio/Gallio.pdb -------------------------------------------------------------------------------- /lib/gallio/MbUnit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/gallio/MbUnit.dll -------------------------------------------------------------------------------- /lib/log4net/log4net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/log4net/log4net.dll -------------------------------------------------------------------------------- /lib/protobuf-net/License.txt: -------------------------------------------------------------------------------- 1 | The core Protocol Buffers technology is provided courtesy of Google. 2 | At the time of writing, this is released under the BSD license. 3 | Full details can be found here: 4 | 5 | http://code.google.com/p/protobuf/ 6 | 7 | 8 | This .NET implementation is Copyright 2008 Marc Gravell 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | -------------------------------------------------------------------------------- /lib/protobuf-net/protobuf-net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/protobuf-net/protobuf-net.dll -------------------------------------------------------------------------------- /lib/protobuf-net/protobuf-net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etishor/CQRSEventSourcingSample/17184d54a1a796a39f9db6dc985131ff7c4668dc/lib/protobuf-net/protobuf-net.pdb -------------------------------------------------------------------------------- /log4net.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /readme.markdown: -------------------------------------------------------------------------------- 1 | ## Sample project demonstrating CQRS & Event Sourcing 2 | ===================================================== 3 | 4 | The sample uses the following projects from Jonathan Oliver (https://github.com/joliver) 5 | 6 | * EventStore 7 | * NanoServiceBus 8 | * CommonDomain 9 | * StorageAccess 10 | 11 | For more information on CQRS and Event Sourcing http://cqrsinfo.com/ 12 | 13 | ## To Run The Sample 14 | 15 | 1. You need to create 3 databases in SQL Server 2008 express: 16 | * Sample.Subscriptions 17 | * Sample.EventStore 18 | * Sample.ReadModel 19 | 20 | On the Sample.Subscriptions table you need to run the lib\NanoMessageBus\SubscriptionStorage.sql to create 21 | the table in which NanoMessageBus will store the subscriptions. 22 | 23 | 2. You need to create 5 transactional Queues in MSMQ: 24 | * Sample.AppService 25 | * Sample.Error 26 | * Sample.Denormalizer 27 | * Sample.Client 28 | * Sample.ReadModel 29 | 30 | 31 | Description of the sample Domain Models implemented: 32 | 33 | ### People 34 | Simple domain consisting of a Person Aggregate Root and two value objects ( PersonName and Address ). 35 | The model allows the creation of a person, the MovePerson operation witch changes the address and the kill-ing 36 | of a person. 37 | 38 | ### Funds 39 | Sample domain with two ARs, Document and ShareClass and some VOs that demonstrates modeling many-to-many between aggregates. 40 | This domain is still work in progress. 41 | 42 | A short description of the projects in the sample: 43 | 44 | ### Write Side 45 | 46 | 1. Sample.DomainModel 47 | - the domain model for the sample 48 | - this model is persisted using event sourcing and does not need to handle reads ( queries ) 49 | since they are done on the read side. 50 | - the resulting event stream is the "source of truth" data. 51 | 52 | 2. Sample.AppService 53 | - the handlers for the commands our domain knows to execute 54 | 55 | 3. Sample.AppServiceHost 56 | - infrastructure for wiring up the command handlers to NanoServiceBus 57 | - this is the actual instance of the service that needs to be running for the write side to process 58 | commands. 59 | 60 | ### Read Side 61 | 62 | 1. Sample.ReadModel 63 | - the read model on witch queries are executed 64 | - this model should be mapped as close as possible to the views 65 | - this model can be regenerated from the event stream 66 | 67 | 2. Sample.Denormalizer 68 | - the event handlers for the domain events that are published by the DomainModel on the WriteSide 69 | - this handlers keep the read model in sync with the event stream 70 | - a better name for it is welcome 71 | 72 | 3. Sample.DenormalizerHost 73 | - infrastructure for wiring up the event handlers to NanoServiceBus 74 | - this process needs to run for the read side to be updated. 75 | 76 | ### Infrastructure 77 | 78 | 1. Sample.Messages 79 | - definitions for commands and events that are handled or published by the Domain Model 80 | 81 | 2. Sample.Client.Web 82 | - ASP.NET MVC3 application that demonstrates how to integrate the WriteSide & the ReadSide in an application. 83 | 84 | 85 | ## TODO 86 | ======= 87 | 88 | - Add more complex objects to the domain 89 | - Review transaction management on integration points 90 | - use ConfOrm for mapping the read model 91 | - Add error handeling/reporting 92 | - Create generic infrastructure to handle message/handler registration in nano message bus 93 | - Add js pooling sample to handle eventual consistency 94 | - Add more inter aggregate communication/operations 95 | 96 | ## Disaclaimer 97 | ============== 98 | 99 | This sample's primary purpose is for me to gain experience with Autofac, NanoMessageBus, 100 | EventStore and all the other projects involved. 101 | -------------------------------------------------------------------------------- /sample.gallio: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Sample.Tests\bin\Debug\Sample.Tests.dll 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | C:\Users\iulian.margarintescu\AppData\Roaming\Gallio\Icarus\Reports 17 | test-report-{0}-{1} 18 | --------------------------------------------------------------------------------