diff --git a/.gitignore b/.gitignore index 439187c3..9c61e998 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ release #dotCover *.dotCover + +#TestResults +/TestResults/* diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/App.config b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/App.config new file mode 100644 index 00000000..5705bd4e --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/App.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/ChangeNoteCommand.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/ChangeNoteCommand.cs new file mode 100644 index 00000000..d86f8411 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/ChangeNoteCommand.cs @@ -0,0 +1,14 @@ +using System; +using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; +using Ncqrs.Commanding; + +namespace Ncqrs.Eventing.Storage.AWS.Tests.Env +{ + [MapsToAggregateRootMethod(typeof(Note), "ChangeNoteText")] + public class ChangeNoteCommand : CommandBase + { + [AggregateRootId] + public Guid NoteId { get; set; } + public string NewNoteText { get; set; } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/CreateNoteCommand.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/CreateNoteCommand.cs new file mode 100644 index 00000000..ed2bdb57 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/CreateNoteCommand.cs @@ -0,0 +1,13 @@ +using System; +using Ncqrs.Commanding; +using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; + +namespace Ncqrs.Eventing.Storage.AWS.Tests.Env +{ + [MapsToAggregateRootConstructor(typeof(Note))] + public class CreateNoteCommand : CommandBase + { + public Guid NoteId { get; set; } + public string NoteText { get; set; } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/Note.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/Note.cs new file mode 100644 index 00000000..04aad113 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/Note.cs @@ -0,0 +1,48 @@ +using System; +using Ncqrs.Domain; + +namespace Ncqrs.Eventing.Storage.AWS.Tests.Env +{ + public class Note : AggregateRootMappedByConvention + { + public string NoteText { get; private set; } + + + public Note(Guid noteId, string noteText) + : base(noteId) + { + if (noteText != null) + { + ApplyEvent(new NoteCreated + { + NoteText = noteText + }); + } + } + + public Note() + { + } + + public void ChangeNoteText(string NewNoteText) + { + ApplyEvent(new NoteChanged + { + NewNoteText = NewNoteText + }); + + } + + protected void OnNoteCreated(NoteCreated e) + { + NoteText = e.NoteText; + } + + protected void OnNoteChange(NoteChanged e) + { + NoteText = e.NewNoteText; + } + + + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/NoteChanged.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/NoteChanged.cs new file mode 100644 index 00000000..8381d45f --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/NoteChanged.cs @@ -0,0 +1,12 @@ +using System; +using Ncqrs.Eventing.Sourcing; + +namespace Ncqrs.Eventing.Storage.AWS.Tests.Env +{ + [Serializable] + public class NoteChanged : SourcedEvent + { + public Guid NoteId { get; set; } + public string NewNoteText { get; set; } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/NoteCreated.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/NoteCreated.cs new file mode 100644 index 00000000..f685580e --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/NoteCreated.cs @@ -0,0 +1,12 @@ +using System; +using Ncqrs.Eventing.Sourcing; + +namespace Ncqrs.Eventing.Storage.AWS.Tests.Env +{ + [Serializable] + public class NoteCreated : SourcedEvent + { + Guid NoteId { get; set; } + public string NoteText { get; set; } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/Startup.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/Startup.cs new file mode 100644 index 00000000..e874b621 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Env/Startup.cs @@ -0,0 +1,18 @@ +using Ncqrs.Commanding.ServiceModel; +using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; + +namespace Ncqrs.Eventing.Storage.AWS.Tests.Env +{ + public static class Startup + { + public static void Start() + { + NcqrsEnvironment.SetDefault(new SimpleDBStore("MainTest")); + CommandService c = new CommandService(); + + c.RegisterExecutorsInAssembly(typeof(CreateNoteCommand).Assembly); + + NcqrsEnvironment.SetDefault(c); + } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/MainTests.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/MainTests.cs new file mode 100644 index 00000000..97afa6a8 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/MainTests.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Ncqrs.Commanding.ServiceModel; +using Ncqrs.Eventing.Storage.AWS.Tests.Env; + +namespace Ncqrs.Eventing.Storage.AWS.Tests +{ + [TestClass] + public class MainTests + { + public MainTests() + { + Startup.Start(); + } + + [TestMethod] + public void SniffForSmoke() + { + Guid smokeID = Guid.NewGuid(); + NcqrsEnvironment.Get().Execute(new CreateNoteCommand + { + NoteId = smokeID, + NoteText = "Hello world" + }); + + NcqrsEnvironment.Get().Execute(new ChangeNoteCommand + { + NoteId = smokeID, + NewNoteText = "Hello universe" + }); + } + + [TestMethod] + public void LoadItUp() + { + IList ids = new List(); + + for (int i = 0; i < 5; i++) + { + Guid id = Guid.NewGuid(); + ids.Add(id); + + NcqrsEnvironment.Get().Execute(new CreateNoteCommand + { + NoteId = id, + NoteText = "Hello world " + i + }); + } + + + foreach (Guid id in ids) + { + NcqrsEnvironment.Get().Execute(new ChangeNoteCommand + { + NoteId = id, + NewNoteText = "Hello solar system" + }); + } + + foreach (Guid id in ids) + { + NcqrsEnvironment.Get().Execute(new ChangeNoteCommand + { + NoteId = id, + NewNoteText = "Hello galaxy" + }); + } + } + } +} \ No newline at end of file diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Ncqrs.Eventing.Storage.AWS.Tests.csproj b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Ncqrs.Eventing.Storage.AWS.Tests.csproj new file mode 100644 index 00000000..9c606714 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Ncqrs.Eventing.Storage.AWS.Tests.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C} + Library + Properties + Ncqrs.Eventing.Storage.AWS.Tests + Ncqrs.Eventing.Storage.AWS.Tests + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\lib\Release\Ncqrs.Eventing.Storage.AWS.Tests\ + TRACE + prompt + 4 + + + + + ..\..\..\lib\ThirdParty\json.net\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + {01F84441-80D3-49B4-AB18-96894ACB2F90} + Ncqrs + + + {B43AEA6E-59C2-4731-91EA-40C36CEE8360} + ApplicationService + + + {D8D8A477-8018-432B-8E85-795E425D4862} + Ncqrs.Eventing.Storage.AWS + + + + + + + + \ No newline at end of file diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Properties/AssemblyInfo.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c4ff90af --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Ncqrs.Eventing.Storage.AWS.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Ncqrs.Eventing.Storage.AWS.Tests")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("84e3fbf7-66d2-4dfe-986a-42909624936e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Ncqrs.Eventing.Storage.AWS.csproj b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Ncqrs.Eventing.Storage.AWS.csproj new file mode 100644 index 00000000..fc87f26f --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Ncqrs.Eventing.Storage.AWS.csproj @@ -0,0 +1,70 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {D8D8A477-8018-432B-8E85-795E425D4862} + Library + Properties + Ncqrs.Eventing.Storage.AWS + Ncqrs.Eventing.Storage.AWS + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\lib\Release\Ncqrs.Eventing.Storage.AWS\ + TRACE + prompt + 4 + + + + ..\lib\ThirdParty\AWSSDK\AWSSDK.dll + + + ..\..\..\lib\ThirdParty\json.net\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + {01F84441-80D3-49B4-AB18-96894ACB2F90} + Ncqrs + + + + + \ No newline at end of file diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Properties/AssemblyInfo.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..31b30e68 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Ncqrs.Eventing.Storage.AWS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Ncqrs.Eventing.Storage.AWS")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4dacacd1-0fbf-46d9-8bd7-a56367086429")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEvent.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEvent.cs new file mode 100644 index 00000000..5aff584f --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEvent.cs @@ -0,0 +1,35 @@ +using System; +using Ncqrs.Eventing.ServiceModel.Bus; + +namespace Ncqrs.Eventing.Storage.AWS +{ + internal class NcqrsEvent + { + public Guid EventSourceId { get; set; } + public Guid EventIdentifier { get; set; } + public Guid CommitId { get; set; } + public string Name { get; set; } + public string Version { get; set; } + public long Sequence { get; set; } + public string Data { get; set; } + public DateTime Timestamp { get; set; } + + public NcqrsEvent() + { } + + public NcqrsEvent(IPublishableEvent @event) + { + Timestamp = DateTime.UtcNow; + EventSourceId = @event.EventSourceId; + EventIdentifier = @event.EventIdentifier; + Name = @event.Payload.GetType().AssemblyQualifiedName; + Sequence = @event.EventSequence; + Version = @event.EventVersion.ToString(); + + if (@event.Payload != null) + { + Data = Utility.Jsonize(@event.Payload, Name); + } + } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEventSource.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEventSource.cs new file mode 100644 index 00000000..6acab50f --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEventSource.cs @@ -0,0 +1,34 @@ +using System; +using Ncqrs.Eventing.Sourcing; + +namespace Ncqrs.Eventing.Storage.AWS +{ + public class NcqrsEventSource + { + public long Version { get; set; } + public string Name { get; set; } + public Guid EventSourceId { get; set; } + public DateTime Timestamp { get; set; } + + public NcqrsEventSource() + { } + + public NcqrsEventSource(IEventSource source) + { + EventSourceId = source.EventSourceId; + Timestamp = DateTime.UtcNow; + Version = source.Version; + Name = source.GetType().ToString(); + } + + public NcqrsEventSource(Guid eventSourceId, + long version, + string name) + { + EventSourceId = eventSourceId; + Timestamp = DateTime.UtcNow; + Version = version; + Name = name; + } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEventStoreContext.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEventStoreContext.cs new file mode 100644 index 00000000..6a413d97 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/NcqrsEventStoreContext.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Amazon.SimpleDB; +using Amazon.SimpleDB.Model; +using Attribute = Amazon.SimpleDB.Model.Attribute; + +namespace Ncqrs.Eventing.Storage.AWS +{ + internal class NcqrsEventStoreContext + { + private readonly Guid _eventSourceID; + private const string _domainName = "NcqrsEventStore"; + private readonly AmazonSimpleDB _account; + + private string EVENTSOURCETABLENAME + { + get + { + return _tablePrefix + _domainName + "Source"; + } + } + private string EVENTTABLENAME + { + get + { + return _tablePrefix + _domainName; + } + } + + private readonly string _tablePrefix; + + public NcqrsEventStoreContext(Guid eventSourceId, + AmazonSimpleDB account) + : this(eventSourceId, account, null) + { + _eventSourceID = eventSourceId; + } + + public NcqrsEventStoreContext(Guid eventSourceId, + AmazonSimpleDB account, + string tablePrefix) + { + _account = account; + _eventSourceID = eventSourceId; + _tablePrefix = tablePrefix; + + CreateIfNotExist(EVENTTABLENAME); + CreateIfNotExist(EVENTSOURCETABLENAME); + } + + private void CreateIfNotExist(string domainName) + { + ListDomainsResponse response = _account.ListDomains(new ListDomainsRequest()); + + if (response.ListDomainsResult.DomainName.Any(domain => domain == domainName)) return; + _account.CreateDomain(new CreateDomainRequest { DomainName = domainName }); + } + + public IQueryable Events + { + get + { + string selectStmt = string.Format("select * from {0} where EventSourceId='{1}'", EVENTTABLENAME, _eventSourceID); + SelectRequest selectRequestAction = new SelectRequest().WithSelectExpression(selectStmt); + SelectResponse result = _account.Select(selectRequestAction); + if (result.SelectResult.Item.Count > 0 && + result.SelectResult.Item[0].Attribute.Count > 0) + { + return result.SelectResult.Item.Select( + item => new NcqrsEvent + { + CommitId = new Guid(item.Attribute.First(a => a.Name == "CommitId").Value), + Data = item.Attribute.First(a => a.Name == "Data").Value, + EventIdentifier = + new Guid(item.Attribute.First(a => a.Name == "EventIdentifier").Value), + EventSourceId = + new Guid(item.Attribute.First(a => a.Name == "EventSourceId").Value), + Name = item.Attribute.First(a => a.Name == "Name").Value, + Sequence = + Convert.ToInt64(item.Attribute.First(a => a.Name == "Sequence").Value), + Timestamp = + Convert.ToDateTime( + item.Attribute.First(a => a.Name == "Timestamp").Value), + Version = item.Attribute.First(a => a.Name == "Version").Value + }).AsQueryable(); + } + return null; + } + } + + public NcqrsEventSource LatestEventSource + { + get + { + string selectStmt = string.Format("select * from {0} where EventSourceId='{1}'", EVENTSOURCETABLENAME, _eventSourceID); + SelectRequest selectRequestAction = new SelectRequest().WithSelectExpression(selectStmt); + SelectResponse result = _account.Select(selectRequestAction); + if (result.SelectResult.Item.Count > 0 && + result.SelectResult.Item[0].Attribute.Count > 0) + { + List attributeCollection = result.SelectResult.Item[0].Attribute; + return new NcqrsEventSource + { + EventSourceId = new Guid(attributeCollection.First(a => a.Name == "EventSourceId").Value), + Name = attributeCollection.First(a => a.Name == "Name").Value, + Timestamp = Convert.ToDateTime(attributeCollection.First(a => a.Name == "Timestamp").Value), + Version = Convert.ToInt64(attributeCollection.First(a => a.Name == "Version").Value) + }; + } + return null; + } + } + + private Guid _commitId = Guid.Empty; + + public Guid BeginCommit() + { + if (_commitId != Guid.Empty) + { + throw new InvalidOperationException("Cannot BeginCommit while CommitId [" + _commitId + "] is still pending"); + } + _commitId = Guid.NewGuid(); + return _commitId; + } + + public void Add(NcqrsEvent @event) + { + if (_commitId == Guid.Empty) + { + throw new InvalidOperationException("Cannot Add events without beginning a commit. Call the BeginCommit method"); + } + @event.CommitId = _commitId; + + List list = + new List(); + list.Add(new ReplaceableAttribute { Name = "Name", Replace = true, Value = @event.Name }); + list.Add(new ReplaceableAttribute { Name = "CommitId", Replace = true, Value = @event.CommitId.ToString() }); + list.Add(new ReplaceableAttribute { Name = "Data", Replace = true, Value = @event.Data }); + list.Add(new ReplaceableAttribute { Name = "EventIdentifier", Replace = true, Value = @event.EventIdentifier.ToString() }); + list.Add(new ReplaceableAttribute { Name = "EventSourceId", Replace = true, Value = @event.EventSourceId.ToString() }); + list.Add(new ReplaceableAttribute { Name = "Sequence", Replace = true, Value = @event.Sequence.ToString(CultureInfo.InvariantCulture) }); + list.Add(new ReplaceableAttribute { Name = "Timestamp", Replace = true, Value = @event.Timestamp.ToString(CultureInfo.InvariantCulture) }); + list.Add(new ReplaceableAttribute { Name = "Version", Replace = true, Value = @event.Version }); + + _account.PutAttributes( + new PutAttributesRequest + { + Attribute = list, + DomainName = EVENTTABLENAME, + ItemName = @event.EventIdentifier.ToString() + }); + } + + public void SaveSource(NcqrsEventSource source) + { + if (_commitId == Guid.Empty) + { + throw new InvalidOperationException("Cannot Add event sources without beginning a commit. Call the BeginCommit method"); + } + + List list = + new List(); + list.Add(new ReplaceableAttribute { Name = "EventSourceId", Replace = true, Value = source.EventSourceId.ToString() }); + list.Add(new ReplaceableAttribute { Name = "Name", Replace = true, Value = source.Name }); + list.Add(new ReplaceableAttribute { Name = "Timestamp", Replace = true, Value = source.Timestamp.ToString(CultureInfo.InvariantCulture) }); + list.Add(new ReplaceableAttribute { Name = "Version", Replace = true, Value = source.Version.ToString(CultureInfo.InvariantCulture) }); + + _account.PutAttributes( + new PutAttributesRequest + { + Attribute = list, + DomainName = EVENTSOURCETABLENAME, + ItemName = source.EventSourceId.ToString() + }); + } + + public void EndCommit() + { + // No trx - can't commit + } + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/SimpleDBStore.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/SimpleDBStore.cs new file mode 100644 index 00000000..15d1bbec --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Table/SimpleDBStore.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Amazon; +using Amazon.SimpleDB; + +namespace Ncqrs.Eventing.Storage.AWS +{ + /// + /// Initialises a new event store that uses Table Storage only. + /// + /// May not be appropriate for events with large payloads + public class SimpleDBStore : IEventStore + { + readonly AmazonSimpleDB account = AWSClientFactory.CreateAmazonSimpleDBClient(); + private string prefix = null; + + public SimpleDBStore() + { } + + /// + /// Creates a new SimpleDBStore, and names the table including the supplied Prefix + /// + /// The prefix for the table name + /// Useful for testing and partitioning, e.g., new TableStorage("TestRun1") + public SimpleDBStore(string prefix) + { + this.prefix = prefix; + } + + private void SaveEvents(Guid eventSourceId, + IEnumerable events) + { + string eventSourceName = events.First().GetType().ToString(); + long initialVersion = events.First().InitialVersionOfEventSource; + long lastVersion = initialVersion + events.Count(); + + NcqrsEventStoreContext storeContext = new NcqrsEventStoreContext(eventSourceId, account, prefix); + Guid commitId = storeContext.BeginCommit(); + + NcqrsEventSource lastSource = storeContext.LatestEventSource; + if (lastSource == null) + { + lastSource = new NcqrsEventSource(eventSourceId, + initialVersion, + eventSourceName); + + } + else if (lastSource.Version != initialVersion) + { + throw new ConcurrencyException(eventSourceId, initialVersion); + } + + foreach (UncommittedEvent @event in events) + { + storeContext.Add(new NcqrsEvent(@event)); + } + + lastSource.Version = lastVersion; + storeContext.SaveSource(lastSource); + + storeContext.EndCommit(); + } + + public CommittedEventStream ReadFrom(Guid id, long minVersion, long maxVersion) + { + NcqrsEventStoreContext eventContext = new NcqrsEventStoreContext(id, account, prefix); + + IQueryable storeEvents = eventContext.Events; + + if (minVersion != long.MinValue) + { + storeEvents = storeEvents.Where(e => e.Sequence >= minVersion); + } + if (maxVersion != long.MaxValue) + { + storeEvents = storeEvents.Where(e => e.Sequence <= maxVersion); + } + + storeEvents = storeEvents.ToList().OrderBy(e => e.Sequence).AsQueryable(); + + IEnumerable committedEvents = storeEvents.Select( + e => new CommittedEvent( + e.CommitId, + e.EventIdentifier, + e.EventSourceId, + e.Sequence, + e.Timestamp, + Utility.DeJsonize(e.Data, e.Name), + Version.Parse(e.Version) + ) + ); + + return new CommittedEventStream(id, committedEvents); + } + + #region IEventStore Members + + public void Store(UncommittedEventStream eventStream) + { + Parallel.ForEach( + eventStream.Select(es => es.EventSourceId).Distinct(), + eventSourceId => SaveEvents(eventSourceId, eventStream.Where(es => es.EventSourceId == eventSourceId)) + ); + } + + #endregion + } +} diff --git a/Extensions/src/Ncqrs.Eventing.Storage.AWS/Utility.cs b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Utility.cs new file mode 100644 index 00000000..18bd6295 --- /dev/null +++ b/Extensions/src/Ncqrs.Eventing.Storage.AWS/Utility.cs @@ -0,0 +1,35 @@ +using System; +using System.Text; +using System.IO; +using Newtonsoft.Json; + +namespace Ncqrs.Eventing.Storage.AWS +{ + public static class Utility + { + public static string Jsonize(object data, Type type) + { + StringBuilder result = new StringBuilder(); + new JsonSerializer().Serialize(new StringWriter(result), data); + return result.ToString(); + } + + public static string Jsonize(object data, string assemblyQualifiedTypeName) + { + Type parsedType = Type.GetType(assemblyQualifiedTypeName, true, true); + return Jsonize(data, parsedType); + } + + public static object DeJsonize(string data, Type type) + { + return new JsonSerializer().Deserialize(new StringReader(data), type); + } + + public static object DeJsonize(string data, string assemblyQualifiedTypeName) + { + Type parsedType = Type.GetType(assemblyQualifiedTypeName, true, true); + return DeJsonize(data, parsedType); + } + + } +} diff --git a/Framework/AssemblyInfo.cs b/Framework/AssemblyInfo.cs index c5fc3d5a..6d06b9e7 100644 --- a/Framework/AssemblyInfo.cs +++ b/Framework/AssemblyInfo.cs @@ -6,7 +6,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.225 +// Runtime Version:4.0.30319.269 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/Framework/src/Ncqrs.Spec/AggregateRootTestFixture.cs b/Framework/src/Ncqrs.Spec/AggregateRootTestFixture.cs index df2e8efe..ba72c6d6 100644 --- a/Framework/src/Ncqrs.Spec/AggregateRootTestFixture.cs +++ b/Framework/src/Ncqrs.Spec/AggregateRootTestFixture.cs @@ -1,34 +1,17 @@ using System; using System.Collections.Generic; -using System.Linq; +using NUnit.Framework; using Ncqrs.Domain; using Ncqrs.Domain.Storage; using Ncqrs.Eventing; -using Ncqrs.Eventing.Sourcing; -using NUnit.Framework; namespace Ncqrs.Spec { [Specification] - [TestFixture] // TODO: Testdriven.net debug runner doesn't recognize inhiret attributes. Use native for now. + [TestFixture] // TODO: Testdriven.net debug runner doesn't recognize inherit attributes. Use native for now. public abstract class AggregateRootTestFixture where TAggregateRoot : AggregateRoot { - protected IAggregateRootCreationStrategy CreationStrategy { get; set; } - - protected TAggregateRoot AggregateRoot { get; set; } - - protected Exception CaughtException { get; private set; } - - protected List PublishedEvents { get; private set; } - - protected virtual IEnumerable Given() - { - return null; - } - - protected virtual void Finally() { } - - protected abstract void When(); + #region Setup/Teardown [Given] [SetUp] // TODO: Testdriven.net debug runner doesn't recognize inhiret attributes. Use native for now. @@ -40,12 +23,12 @@ public void Setup() AggregateRoot = CreationStrategy.CreateAggregateRoot(); PublishedEvents = new List(); - - var history = Given(); - if(history != null) + + IEnumerable history = Given(); + if (history != null) { long sequence = 0; - var stream = Prepare.Events(history).ForSource(AggregateRoot.EventSourceId); + CommittedEventStream stream = Prepare.Events(history).ForSource(AggregateRoot.EventSourceId); AggregateRoot.InitializeFromHistory(stream); } @@ -63,5 +46,26 @@ public void Setup() Finally(); } } + + #endregion + + protected IAggregateRootCreationStrategy CreationStrategy { get; set; } + + protected TAggregateRoot AggregateRoot { get; set; } + + protected Exception CaughtException { get; private set; } + + protected List PublishedEvents { get; private set; } + + protected virtual IEnumerable Given() + { + return null; + } + + protected virtual void Finally() + { + } + + protected abstract void When(); } } \ No newline at end of file diff --git a/Framework/src/Ncqrs.Spec/AndAttribute.cs b/Framework/src/Ncqrs.Spec/AndAttribute.cs index a1b01e23..0edcdb07 100644 --- a/Framework/src/Ncqrs.Spec/AndAttribute.cs +++ b/Framework/src/Ncqrs.Spec/AndAttribute.cs @@ -1,6 +1,4 @@ -using System; - -namespace Ncqrs.Spec +namespace Ncqrs.Spec { public class AndAttribute : ThenAttribute { diff --git a/Framework/src/Ncqrs.Spec/CommandTestFixture.cs b/Framework/src/Ncqrs.Spec/CommandTestFixture.cs index 67cac1cf..478b3b9a 100644 --- a/Framework/src/Ncqrs.Spec/CommandTestFixture.cs +++ b/Framework/src/Ncqrs.Spec/CommandTestFixture.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using Ncqrs.Commanding; +using Ncqrs.Commanding; using Ncqrs.Commanding.CommandExecution; -using Ncqrs.Eventing; -using NUnit.Framework; namespace Ncqrs.Spec { diff --git a/Framework/src/Ncqrs.Spec/DomainTestFixture.cs b/Framework/src/Ncqrs.Spec/DomainTestFixture.cs index 7fbe1893..dc5e5b95 100644 --- a/Framework/src/Ncqrs.Spec/DomainTestFixture.cs +++ b/Framework/src/Ncqrs.Spec/DomainTestFixture.cs @@ -5,7 +5,6 @@ namespace Ncqrs.Spec { - [Specification] public abstract class DomainTestFixture : BaseTestFixture diff --git a/Framework/src/Ncqrs.Spec/EventContext.cs b/Framework/src/Ncqrs.Spec/EventContext.cs index 3ac1b6ca..b0eaaee3 100644 --- a/Framework/src/Ncqrs.Spec/EventContext.cs +++ b/Framework/src/Ncqrs.Spec/EventContext.cs @@ -3,7 +3,6 @@ using System.Diagnostics.Contracts; using Ncqrs.Domain; using Ncqrs.Eventing; -using Ncqrs.Eventing.Sourcing; namespace Ncqrs.Spec { @@ -55,7 +54,7 @@ public EventContext() private void InitializeAppliedEventHandler() { if(_eventAppliedCallback == null) - _eventAppliedCallback = new Action(AggregateRootEventAppliedHandler); + _eventAppliedCallback = AggregateRootEventAppliedHandler; AggregateRoot.RegisterThreadStaticEventAppliedCallback(_eventAppliedCallback); } diff --git a/Framework/src/Ncqrs.Spec/EventSerializationFixture.cs b/Framework/src/Ncqrs.Spec/EventSerializationFixture.cs index 232af56e..5bd6e879 100644 --- a/Framework/src/Ncqrs.Spec/EventSerializationFixture.cs +++ b/Framework/src/Ncqrs.Spec/EventSerializationFixture.cs @@ -57,18 +57,12 @@ public void the_deserialized_event_should_not_be_null() [Then] public void the_value_of_each_public_property_is_the_same() - { - var inconclusiveItems = new List(); - + { var props = GetProperties(); - var indexedProps = props.Where(p => p.GetIndexParameters().Any()); - - foreach (var prop in indexedProps) - inconclusiveItems.Add( - string.Format( - "{0} is an indexed property and can't be tested automatically", - prop.Name)); - + var indexedProps = props.Where(p => p.GetIndexParameters().Any()); + + var inconclusiveItems = indexedProps.Select(prop => string.Format("{0} is an indexed property and can't be tested automatically", prop.Name)).ToList(); + var unindexedProps = props.Except(indexedProps); TestItems( diff --git a/Framework/src/Ncqrs.Spec/JsonEventSerializationFixture.cs b/Framework/src/Ncqrs.Spec/JsonEventSerializationFixture.cs index ce5c7048..fc33ad75 100644 --- a/Framework/src/Ncqrs.Spec/JsonEventSerializationFixture.cs +++ b/Framework/src/Ncqrs.Spec/JsonEventSerializationFixture.cs @@ -8,16 +8,15 @@ namespace Ncqrs.Spec { public abstract class JsonEventSerializationFixture : EventSerializationFixture - { - - public JsonEventSerializationFixture() + { + protected JsonEventSerializationFixture() { _formatter = BuildFormatter(); } protected string EventName { get; private set; } - private IEventFormatter _formatter; + private readonly IEventFormatter _formatter; protected override string Serialize(T @event) { diff --git a/Framework/src/Ncqrs.Spec/Prepare.cs b/Framework/src/Ncqrs.Spec/Prepare.cs index 084698b8..2e868213 100644 --- a/Framework/src/Ncqrs.Spec/Prepare.cs +++ b/Framework/src/Ncqrs.Spec/Prepare.cs @@ -1,12 +1,24 @@ using System; using System.Collections.Generic; +using System.Linq; using Ncqrs.Eventing; -using Ncqrs.Eventing.Sourcing; namespace Ncqrs.Spec { public static class Prepare { + public static PrepareTheseEvents Events(IEnumerable events) + { + return new PrepareTheseEvents(events); + } + + public static PrepareTheseEvents Events(params object[] events) + { + return new PrepareTheseEvents(events); + } + + #region Nested type: PrepareTheseEvents + public class PrepareTheseEvents { private readonly IEnumerable _events; @@ -20,9 +32,9 @@ public CommittedEventStream ForSource(Guid id, int sequenceOffset = 0) { int sequence = sequenceOffset + 1; - var commitId = Guid.NewGuid(); + Guid commitId = Guid.NewGuid(); var comittedEvents = new List(); - foreach (var evnt in _events) + foreach (object evnt in _events) { var committedEvent = new CommittedEvent(commitId, Guid.NewGuid(), id, sequence, DateTime.UtcNow, evnt, new Version(1, 0)); @@ -33,16 +45,18 @@ public CommittedEventStream ForSource(Guid id, int sequenceOffset = 0) } public UncommittedEventStream ForSourceUncomitted(Guid id, Guid commitId, int sequenceOffset = 0) - { + { int initialVersion = sequenceOffset == 0 ? 1 : sequenceOffset; int sequence = initialVersion; - var comittedEvents = new List(); var result = new UncommittedEventStream(commitId); - foreach (var evnt in _events) + foreach (UncommittedEvent uncommittedEvent + in _events.Select(evnt => + new UncommittedEvent(Guid.NewGuid(), + id, sequence, initialVersion, + DateTime.UtcNow, + evnt, new Version(1, 0)))) { - var uncommittedEvent = new UncommittedEvent(Guid.NewGuid(), id, sequence, initialVersion, DateTime.UtcNow, - evnt, new Version(1, 0)); result.Append(uncommittedEvent); sequence++; } @@ -50,14 +64,6 @@ public UncommittedEventStream ForSourceUncomitted(Guid id, Guid commitId, int se } } - public static PrepareTheseEvents Events(IEnumerable events) - { - return new PrepareTheseEvents(events); - } - - public static PrepareTheseEvents Events(params object[] events) - { - return new PrepareTheseEvents(events); - } + #endregion } -} +} \ No newline at end of file diff --git a/Framework/src/Ncqrs/Commanding/CommandBase.cs b/Framework/src/Ncqrs/Commanding/CommandBase.cs index 81401f4e..e3cfeab4 100644 --- a/Framework/src/Ncqrs/Commanding/CommandBase.cs +++ b/Framework/src/Ncqrs/Commanding/CommandBase.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.Contracts; -using System.Linq; using System.Runtime.Serialization; using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/AttributeBasedCommandMapper.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/AttributeBasedCommandMapper.cs index 0bf6a18c..9ac776c3 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/AttributeBasedCommandMapper.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/AttributeBasedCommandMapper.cs @@ -50,10 +50,9 @@ public void Map(ICommand command, IMappedCommandExecutor executor) var commandType = command.GetType(); IEnumerable attributes = commandType.GetCustomAttributes(false); - dynamic attributeHandler; - foreach (dynamic attribute in attributes) { + dynamic attributeHandler; if (_handlers.TryGetValue(attribute.GetType(), out attributeHandler)) { attributeHandler.Map(attribute, command, executor); diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootConstructorAttribute.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootConstructorAttribute.cs index f71dcb6d..00b2f639 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootConstructorAttribute.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootConstructorAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Linq; -using System.Reflection; -using Ncqrs.Domain; namespace Ncqrs.Commanding.CommandExecution.Mapping.Attributes { @@ -31,9 +28,7 @@ public Type Type { //delay resolving the type from type name to avoid potentially //loading another assembly whilst holding class loader locks. - if (_type == null) - _type = Type.GetType(TypeName, true); - return _type; + return _type ?? (_type = Type.GetType(TypeName, true)); } } @@ -44,7 +39,7 @@ public Type Type /// Thrown when typeName is null or emtpy. public MapsToAggregateRootConstructorAttribute(String typeName) { - if(String.IsNullOrEmpty(typeName)) throw new ArgumentNullException(typeName); + if (String.IsNullOrEmpty(typeName)) throw new ArgumentNullException(typeName); TypeName = typeName; } @@ -60,6 +55,6 @@ public MapsToAggregateRootConstructorAttribute(Type type) _type = type; TypeName = type.AssemblyQualifiedName; - } + } } } diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodAttribute.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodAttribute.cs index 20712acd..8e8d77b7 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodAttribute.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Linq; -using System.Reflection; -using Ncqrs.Domain; namespace Ncqrs.Commanding.CommandExecution.Mapping.Attributes { @@ -31,9 +28,7 @@ public Type Type { //delay resolving the type from type name to avoid potentially //loading another assembly whilst holding class loader locks. - if (_type == null) - _type = Type.GetType(TypeName, true); - return _type; + return _type ?? (_type = Type.GetType(TypeName, true)); } } diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttribute.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttribute.cs index 8b59b9b4..a14892a9 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttribute.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttribute.cs @@ -24,14 +24,12 @@ public String TypeName /// public Type Type { - get - { + get + { //delay resolving the type from type name to avoid potentially - //loading another assembly whilst holding class loader locks. - if (_type == null) - _type = Type.GetType(TypeName, true); - return _type; - } + //loading another assembly whilst holding class loader locks. + return _type ?? (_type = Type.GetType(TypeName, true)); + } } /// diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttributeHandler.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttributeHandler.cs index 6dee7ccf..5e290219 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttributeHandler.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootMethodOrConstructorAttributeHandler.cs @@ -22,7 +22,7 @@ public void Map(MapsToAggregateRootMethodOrConstructorAttribute attribute, IComm }; var creatingMatch = GetMatchingConstructor(attribute, commandType); - Func create = (c) => + Func create = c => { var parameter = match.Item2.Select(p => p.GetValue(c, null)); return (AggregateRoot)creatingMatch.Item1.Invoke(parameter.ToArray()); diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttribute.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttribute.cs index b4c2d90d..749b9635 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttribute.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Linq; -using System.Reflection; -using Ncqrs.Domain; namespace Ncqrs.Commanding.CommandExecution.Mapping.Attributes { @@ -31,9 +28,7 @@ public Type Type { //delay resolving the type from type name to avoid potentially //loading another assembly whilst holding class loader locks. - if (_type == null) - _type = Type.GetType(TypeName, true); - return _type; + return _type ?? (_type = Type.GetType(TypeName, true)); } } diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttributeHandler.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttributeHandler.cs index dc560177..aa3fcae0 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttributeHandler.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Attributes/MapsToAggregateRootStaticCreateAttributeHandler.cs @@ -14,7 +14,7 @@ public void Map(MapsToAggregateRootStaticCreateAttribute attribute, ICommand com var match = GetMatchingMethod(attribute, commandType, attribute.MethodName); - Func create = (c) => + Func create = c => { var parameter = match.Item2.Select(p => p.GetValue(c, null)); return @@ -38,7 +38,7 @@ private static Tuple GetMatchingMethod(MapsToAggrega { var strategy = new AttributePropertyMappingStrategy(); var sources = strategy.GetMappedProperties(commandType); - var bindingFlags = BindingFlags.Public | BindingFlags.Static; + const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Static; return PropertiesToMethodMapper.GetMethod(sources, attribute.Type, bindingFlags, methodName); } diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/Map.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/Map.cs index a791a323..89eb2c1e 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/Map.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/Map.cs @@ -1,6 +1,4 @@ -using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; - -namespace Ncqrs.Commanding.CommandExecution.Mapping.Fluent +namespace Ncqrs.Commanding.CommandExecution.Mapping.Fluent { /// /// Static Map class that defines easy to use command mapping methods. diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommand.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommand.cs index c7492865..d6a0b682 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommand.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommand.cs @@ -1,4 +1,5 @@ -using Ncqrs.Domain; +using System; +using Ncqrs.Domain; namespace Ncqrs.Commanding.CommandExecution.Mapping.Fluent { diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommandToAggregateRoot.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommandToAggregateRoot.cs index 0dcfa34e..0e3dc4da 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommandToAggregateRoot.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/Fluent/MappedCommandToAggregateRoot.cs @@ -101,6 +101,7 @@ public MappedCommandToAggregateRootMethodOrConstructor UseEx /// called on the aggregateroot of type to use an existing aggregate root or create a new root if needed /// /// The method responsible for retrieving the id of the aggregateroot from the command. + /// /// The method responsible for creating the aggregateroot of type . /// A . public MappedCommandToAggregateRootMethodOrConstructor UseExistingOrCreateNew(Func getidfromcommandfunc, Func getaggregaterootfunc, Func aggregaterootcreatorfunc) diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/PropertiesToMethodMapper.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/PropertiesToMethodMapper.cs index 36620b34..de3c8544 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/PropertiesToMethodMapper.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/Mapping/PropertiesToMethodMapper.cs @@ -10,45 +10,50 @@ namespace Ncqrs.Commanding.CommandExecution.Mapping public class PropertiesToMethodMapper { private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static BindingFlags All = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; + private const BindingFlags All = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; - public static Tuple GetConstructor(PropertyToParameterMappingInfo[] sources, Type targetType) + public static Tuple GetConstructor(PropertyToParameterMappingInfo[] sources, + Type targetType) { - var potentialTargets = targetType.GetConstructors(All); + ConstructorInfo[] potentialTargets = targetType.GetConstructors(All); return GetMethodBase(sources, potentialTargets); } - public static Tuple GetMethod(PropertyToParameterMappingInfo[] sources, Type targetType, BindingFlags bindingFlags, string methodName = null) + public static Tuple GetMethod(PropertyToParameterMappingInfo[] sources, + Type targetType, BindingFlags bindingFlags, + string methodName = null) { IEnumerable potentialTargets = targetType.GetMethods(bindingFlags); if (methodName != null) { potentialTargets = potentialTargets.Where - ( - method => method.Name.Equals(methodName, StringComparison.InvariantCultureIgnoreCase) - ); + ( + method => method.Name.Equals(methodName, StringComparison.InvariantCultureIgnoreCase) + ); } return GetMethodBase(sources, potentialTargets); } - public static Tuple GetMethod(PropertyToParameterMappingInfo[] sources, Type targetType, string methodName = null) + public static Tuple GetMethod(PropertyToParameterMappingInfo[] sources, + Type targetType, string methodName = null) { IEnumerable potentialTargets = targetType.GetMethods(All); - if(methodName != null) + if (methodName != null) { potentialTargets = potentialTargets.Where - ( - method => method.Name.Equals(methodName, StringComparison.InvariantCultureIgnoreCase) - ); + ( + method => method.Name.Equals(methodName, StringComparison.InvariantCultureIgnoreCase) + ); } return GetMethodBase(sources, potentialTargets); } - private static Tuple GetMethodBase(PropertyToParameterMappingInfo[] sources, IEnumerable potentialTargets) + private static Tuple GetMethodBase( + IEnumerable sources, IEnumerable potentialTargets) where TMethodBase : MethodBase { var propertiesToMap = new List(sources); @@ -59,12 +64,12 @@ private static Tuple GetMethodBase(Pro MakeSureAllPropertieOrdinalsAreUnique(propertiesToMap); // Remove all targets that do no match the parameter count. - targets.RemoveAll(t=>!HasCorrectParameterCount(t, propertiesToMap.Count)); + targets.RemoveAll(t => !HasCorrectParameterCount(t, propertiesToMap.Count)); if (targets.IsEmpty()) { - var msg = string.Format("No target found that accepts {0} parameter(s).", - propertiesToMap.Count); + string msg = string.Format("No target found that accepts {0} parameter(s).", + propertiesToMap.Count); throw new CommandMappingException(msg); } @@ -78,80 +83,87 @@ private static Tuple GetMethodBase(Pro throw new CommandMappingException("No target found that matches the mapping."); } - var matches = FilterCtorTargetsOnNameMappedProperties(targets, mappedProps, propertiesToMap); + List> matches = FilterCtorTargetsOnNameMappedProperties(targets, + mappedProps, + propertiesToMap); - if (matches.Count() == 0) + if (!matches.Any()) { // TODO: Throw proper ex. throw new CommandMappingException("No target on found that matches the mapping."); } - else if (matches.Count() > 1) + if (matches.Count() > 1) { // TODO: Throw proper ex. throw new CommandMappingException("Multi targets on found that matches the mapping."); } - var match = matches.Single(); - return new Tuple((TMethodBase)match.Item1, match.Item2); + Tuple match = matches.Single(); + return new Tuple((TMethodBase) match.Item1, match.Item2); } - private static void MakeSureAllPropertieOrdinalsAreUnique(List propertiesToMap) + private static void MakeSureAllPropertieOrdinalsAreUnique(IEnumerable propertiesToMap) { Contract.Requires(propertiesToMap != null); - var query = from p in propertiesToMap - where p.Ordinal.HasValue - group p by p.Ordinal - into g - where g.Count() > 1 - select g.First(); + IEnumerable query = from p in propertiesToMap + where p.Ordinal.HasValue + group p by p.Ordinal + into g + where g.Count() > 1 + select g.First(); - if (query.Count() > 0) + if (query.Any()) { - var firstDuplicate = query.First(); + PropertyToParameterMappingInfo firstDuplicate = query.First(); - throw new CommandMappingException("Cannot map multiple properties with the same name " + firstDuplicate.TargetName + "."); + throw new CommandMappingException("Cannot map multiple properties with the same name " + + firstDuplicate.TargetName + "."); } } - private static void MakeSureAllPropertiesToMapOnNameHaveUniqueNames(List propertiesToMap) + private static void MakeSureAllPropertiesToMapOnNameHaveUniqueNames( + IEnumerable propertiesToMap) { Contract.Requires(propertiesToMap != null); - var query = from p in propertiesToMap - where !p.TargetName.IsNullOrEmpty() - group p by p.TargetName - into g - where g.Count() > 1 - select g.First(); + IEnumerable query = from p in propertiesToMap + where !p.TargetName.IsNullOrEmpty() + group p by p.TargetName + into g + where g.Count() > 1 + select g.First(); - if (query.Count() > 0) + if (query.Any()) { - var firstDuplicate = query.First(); + PropertyToParameterMappingInfo firstDuplicate = query.First(); // TODO: Better exception.) - throw new CommandMappingException("Cannot map multiple properties with the same name " + firstDuplicate.TargetName + + throw new CommandMappingException("Cannot map multiple properties with the same name " + + firstDuplicate.TargetName + "."); } } - private static List> FilterCtorTargetsOnNameMappedProperties(List potentialTargets, PropertyInfo[] mappedProps, List propertiesToMap) + private static List> FilterCtorTargetsOnNameMappedProperties( + IEnumerable potentialTargets, PropertyInfo[] mappedProps, + List propertiesToMap) { var result = new List>(); - foreach (var method in potentialTargets) + foreach (MethodBase method in potentialTargets) { - var parameters = method.GetParameters(); + ParameterInfo[] parameters = method.GetParameters(); var mapped = new List(mappedProps); - var toMap = propertiesToMap.Clone(); + List toMap = propertiesToMap.Clone(); for (int i = 0; i < parameters.Length; i++) { - var prop = mapped[i]; - var param = parameters[i]; + PropertyInfo prop = mapped[i]; + ParameterInfo param = parameters[i]; if (prop == null) { - var matchedOnName = toMap.SingleOrDefault + PropertyToParameterMappingInfo matchedOnName = toMap.SingleOrDefault ( p => p.TargetName.Equals(param.Name, StringComparison.InvariantCultureIgnoreCase) ); @@ -176,12 +188,12 @@ private static List> FilterCtorTargetsOnNameMa private static bool IsTargetInvokableFromKnownProperties(MethodBase target, PropertyInfo[] mappedProps) { bool isInvokable = true; - var parameters = target.GetParameters(); + ParameterInfo[] parameters = target.GetParameters(); for (int i = 0; i < mappedProps.Length; i++) { - var prop = mappedProps[i]; - var param = parameters[i]; + PropertyInfo prop = mappedProps[i]; + ParameterInfo param = parameters[i]; if (prop != null) { @@ -198,11 +210,12 @@ private static bool HasCorrectParameterCount(MethodBase target, int parameterCou return target.GetParameters().Length == parameterCount; } - private static void AddOrdinalMappedProperties(PropertyInfo[] mappedProps, List propertiesToMap) + private static void AddOrdinalMappedProperties(PropertyInfo[] mappedProps, + List propertiesToMap) { for (int i = 0; i < propertiesToMap.Count; i++) { - var prop = propertiesToMap[i]; + PropertyToParameterMappingInfo prop = propertiesToMap[i]; if (prop.Ordinal.HasValue) { @@ -224,7 +237,7 @@ private static void AddOrdinalMappedProperties(PropertyInfo[] mappedProps, List< private static ParameterAttribute GetParameterAttribute(PropertyInfo prop) { - return (ParameterAttribute)prop.GetCustomAttributes(typeof(ParameterAttribute), false).SingleOrDefault(); + return (ParameterAttribute) prop.GetCustomAttributes(typeof (ParameterAttribute), false).SingleOrDefault(); } } } \ No newline at end of file diff --git a/Framework/src/Ncqrs/Commanding/CommandExecution/TransactionalCommandExecutorWrapper.cs b/Framework/src/Ncqrs/Commanding/CommandExecution/TransactionalCommandExecutorWrapper.cs index 9d0ccfb6..7e5b6497 100644 --- a/Framework/src/Ncqrs/Commanding/CommandExecution/TransactionalCommandExecutorWrapper.cs +++ b/Framework/src/Ncqrs/Commanding/CommandExecution/TransactionalCommandExecutorWrapper.cs @@ -1,7 +1,6 @@ using System; -using System.Diagnostics.Contracts; -using System.Transactions; - +using System.Diagnostics.Contracts; + namespace Ncqrs.Commanding.CommandExecution { /// diff --git a/Framework/src/Ncqrs/Commanding/ServiceModel/CommandService.cs b/Framework/src/Ncqrs/Commanding/ServiceModel/CommandService.cs index 5a2cc001..6876eebd 100644 --- a/Framework/src/Ncqrs/Commanding/ServiceModel/CommandService.cs +++ b/Framework/src/Ncqrs/Commanding/ServiceModel/CommandService.cs @@ -71,7 +71,7 @@ public virtual void RegisterExecutor(Type commandType, ICommandExecuto { Contract.Requires(typeof(TCommand).IsAssignableFrom(commandType)); if (_executors.ContainsKey(commandType)) return; - Action action = (cmd) => executor.Execute((TCommand) cmd); + Action action = cmd => executor.Execute((TCommand) cmd); _executors.Add(commandType, action); } @@ -84,14 +84,13 @@ public virtual void RegisterExecutor(Type commandType, ICommandExecuto public virtual void RegisterExecutor(ICommandExecutor executor) where TCommand : ICommand { if (_executors.ContainsKey(typeof(TCommand))) return; - Action action = (cmd) => executor.Execute((TCommand) cmd); + Action action = cmd => executor.Execute((TCommand) cmd); _executors.Add(typeof(TCommand), action); } /// /// Unregisters the executor of the specified command type. The executor will not be called any more. /// - /// The executor to unregister. /// Occurs when the commandType or executor was a null dereference. /// Occurs when the executor is not the same as the registered executor for the specified command type. public virtual void UnregisterExecutor() where TCommand : ICommand diff --git a/Framework/src/Ncqrs/Domain/Storage/AggregateRootCreationStrategy.cs b/Framework/src/Ncqrs/Domain/Storage/AggregateRootCreationStrategy.cs index 77007f01..e18240c4 100644 --- a/Framework/src/Ncqrs/Domain/Storage/AggregateRootCreationStrategy.cs +++ b/Framework/src/Ncqrs/Domain/Storage/AggregateRootCreationStrategy.cs @@ -1,6 +1,5 @@ -using System; -using System.Reflection; - +using System; + namespace Ncqrs.Domain.Storage { public abstract class AggregateRootCreationStrategy diff --git a/Framework/src/Ncqrs/Domain/Storage/DefaultAggregateSnapshotter.cs b/Framework/src/Ncqrs/Domain/Storage/DefaultAggregateSnapshotter.cs index 5d5ec6b5..ab3ae957 100644 --- a/Framework/src/Ncqrs/Domain/Storage/DefaultAggregateSnapshotter.cs +++ b/Framework/src/Ncqrs/Domain/Storage/DefaultAggregateSnapshotter.cs @@ -1,7 +1,5 @@ using System; using System.Reflection; -using System.Reflection.Emit; -using System.Linq; using Ncqrs.Eventing; using Ncqrs.Eventing.Sourcing.Snapshotting; diff --git a/Framework/src/Ncqrs/Eventing/CommittedEvent.cs b/Framework/src/Ncqrs/Eventing/CommittedEvent.cs index 4553f787..05941d34 100644 --- a/Framework/src/Ncqrs/Eventing/CommittedEvent.cs +++ b/Framework/src/Ncqrs/Eventing/CommittedEvent.cs @@ -79,6 +79,16 @@ public long EventSequence get { return _eventSequence; } } + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// public CommittedEvent(Guid commitId, Guid eventIdentifier, Guid eventSourceId, long eventSequence, DateTime eventTimeStamp, object payload, Version eventVersion) { _payload = payload; diff --git a/Ncqrs.Master.sln b/Ncqrs.Master.sln index 12eb2896..53c26b1d 100644 --- a/Ncqrs.Master.sln +++ b/Ncqrs.Master.sln @@ -1,15 +1,22 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs", "Framework\src\Ncqrs\Ncqrs.csproj", "{01F84441-80D3-49B4-AB18-96894ACB2F90}" +# SharpDevelop 4.2.1.8805 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{086A35E7-E3B8-449E-83A3-25A540148B86}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Spec", "Framework\src\Ncqrs.Spec\Ncqrs.Spec.csproj", "{AA90754B-CA47-429E-BDC8-2A83E94179B7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Tests", "Framework\src\Ncqrs.Tests\Ncqrs.Tests.csproj", "{50E98525-806C-41E3-9366-D36B1CD936D0}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{086A35E7-E3B8-449E-83A3-25A540148B86}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs", "Framework\src\Ncqrs\Ncqrs.csproj", "{01F84441-80D3-49B4-AB18-96894ACB2F90}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Tests.Integration", "Framework\src\Ncqrs.Tests.Integration\Ncqrs.Tests.Integration.csproj", "{D300CE86-E8DF-4E9A-9FEB-A2355661A9F2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{4EAA1C9A-E268-4BA7-A73E-940E3D769C3A}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Config.StructureMap", "Extensions\src\Ncqrs.Config.StructureMap\Ncqrs.Config.StructureMap.csproj", "{2558F4AD-8D5D-43A2-AAEA-75B966F9B4DE}" ProjectSection(ProjectDependencies) = postProject @@ -56,57 +63,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.NServiceBus", "Extens EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.NServiceBus.Tests", "Extensions\src\Ncqrs.NServiceBus.Tests\Ncqrs.NServiceBus.Tests.csproj", "{86D87653-EC64-4388-A5F7-2F64F690C5F5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{84A6E29C-BC29-4348-BA51-4218E75CED1A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MyNotes", "MyNotes", "{8478A8FA-7295-4098-866D-47F458C766C8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands", "Samples\MyNotes\src\Commands\Commands.csproj", "{CF0635EB-DFA4-4E82-B245-A0F125183E08}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Samples\MyNotes\src\Domain\Domain.csproj", "{BD0344CC-E61E-4BC6-8782-0AC0390F48FD}" - ProjectSection(ProjectDependencies) = postProject - {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Events", "Samples\MyNotes\src\Events\Events.csproj", "{705805EF-47BE-48A8-A359-CA999169E445}" - ProjectSection(ProjectDependencies) = postProject - {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadModel", "Samples\MyNotes\src\ReadModel\ReadModel.csproj", "{D01CE8F6-800E-44CC-886B-F862B10E1396}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Samples\NSBSample\Client\Client.csproj", "{97B83914-6A1A-4EF4-AE40-F5CE4FA48FA8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NSBSample", "NSBSample", "{963C0C88-DCB6-4944-94EC-728CBB3C2778}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands", "Samples\NSBSample\Commands\Commands.csproj", "{5EF85227-BF8E-4A19-8496-2A3BB500E27C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Samples\NSBSample\Domain\Domain.csproj", "{B233A995-93BA-4B6F-8227-EF2A57C750BD}" - ProjectSection(ProjectDependencies) = postProject - {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Events", "Samples\NSBSample\Events\Events.csproj", "{5088657E-AC3F-4081-B0B8-ACFBBD6BFA28}" - ProjectSection(ProjectDependencies) = postProject - {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Samples\NSBSample\Server\Server.csproj", "{E55F2D87-CBA5-48CE-AF6E-FBF069084BAF}" - ProjectSection(ProjectDependencies) = postProject - {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppV1", "Samples\VersioningSample\src\Appv1\AppV1.csproj", "{ECE2E2E8-648C-4561-82A0-9A1D6A2D4645}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VersioningSample", "VersioningSample", "{E7C55656-EC73-4802-9ED4-1BC321C86ABA}" - ProjectSection(SolutionItems) = preProject - Samples\VersioningSample\CreateEventStore.sql = Samples\VersioningSample\CreateEventStore.sql - Samples\VersioningSample\readme.txt = Samples\VersioningSample\readme.txt - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppV2", "Samples\VersioningSample\src\AppV2\AppV2.csproj", "{7A3419B2-588C-416B-A9F3-BFAE77C22D77}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppV3", "Samples\VersioningSample\src\AppV3\AppV3.csproj", "{2489CF5D-6CEE-44C7-825D-521383275DB7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.EventBus", "Extensions\src\Ncqrs.EventBus\Ncqrs.EventBus.csproj", "{CAF2E548-87C8-422B-A62C-8C3ED83FF3C3}" ProjectSection(ProjectDependencies) = postProject {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} @@ -136,10 +92,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.JOli EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.JOliver.Tests", "Extensions\src\Ncqrs.Eventing.Storage.JOliver.Tests\Ncqrs.Eventing.Storage.JOliver.Tests.csproj", "{7C4B1AD0-C354-47D1-A9AB-793AE2AD52A2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationService", "Samples\MyNotes\src\ApplicationService\ApplicationService.csproj", "{B43AEA6E-59C2-4731-91EA-40C36CEE8360}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Tests.Integration", "Framework\src\Ncqrs.Tests.Integration\Ncqrs.Tests.Integration.csproj", "{D300CE86-E8DF-4E9A-9FEB-A2355661A9F2}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.JOliver.RavenPersistence", "Extensions\src\Ncqrs.Eventing.Storage.JOliver.RavenPersistence\Ncqrs.Eventing.Storage.JOliver.RavenPersistence.csproj", "{A2ADE0B3-D3C0-4D6B-8701-C0F5E509A69A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.WindowsAzure", "Extensions\src\Ncqrs.Eventing.Storage.WindowsAzure\Ncqrs.Eventing.Storage.WindowsAzure.csproj", "{6535AFF3-E730-4916-9CF6-1186F3C1DAFE}" @@ -159,6 +111,38 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Config.Ninject.Tests" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.Postgre", "Extensions\src\Ncqrs.Eventing.Storage.Postgre\Ncqrs.Eventing.Storage.Postgre.csproj", "{73EFEBCC-4B62-470B-A27B-D846359FF600}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot", "Extensions\src\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.csproj", "{618E1C0F-E6B7-4C51-961D-C4ACE60CFC85}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.Tests", "Extensions\src\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.Tests\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.Tests.csproj", "{85073A89-CC13-44E2-B8C2-FB0B638B60F7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.AWS", "Extensions\src\Ncqrs.Eventing.Storage.AWS\Ncqrs.Eventing.Storage.AWS.csproj", "{D8D8A477-8018-432B-8E85-795E425D4862}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Storage.AWS.Tests", "Extensions\src\Ncqrs.Eventing.Storage.AWS.Tests\Ncqrs.Eventing.Storage.AWS.Tests.csproj", "{04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{84A6E29C-BC29-4348-BA51-4218E75CED1A}" + ProjectSection(SolutionItems) = postProject + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MyNotes", "MyNotes", "{8478A8FA-7295-4098-866D-47F458C766C8}" + ProjectSection(SolutionItems) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands", "Samples\MyNotes\src\Commands\Commands.csproj", "{CF0635EB-DFA4-4E82-B245-A0F125183E08}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Samples\MyNotes\src\Domain\Domain.csproj", "{BD0344CC-E61E-4BC6-8782-0AC0390F48FD}" + ProjectSection(ProjectDependencies) = postProject + {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Events", "Samples\MyNotes\src\Events\Events.csproj", "{705805EF-47BE-48A8-A359-CA999169E445}" + ProjectSection(ProjectDependencies) = postProject + {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadModel", "Samples\MyNotes\src\ReadModel\ReadModel.csproj", "{D01CE8F6-800E-44CC-886B-F862B10E1396}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationService", "Samples\MyNotes\src\ApplicationService\ApplicationService.csproj", "{B43AEA6E-59C2-4731-91EA-40C36CEE8360}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Samples\MyNotes\src\Tests\Tests.csproj", "{1F4B376F-D08C-4C8B-AB6E-16F70173FBB5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Samples\MyNotes\src\Website\Website.csproj", "{6F1765AB-F3DD-40C0-8D80-C1E1A20173E3}" @@ -168,9 +152,40 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Samples\MyNotes\ {9CBAEAFE-9265-47BA-82C5-5E0774CBF2C5} = {9CBAEAFE-9265-47BA-82C5-5E0774CBF2C5} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot", "Extensions\src\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.csproj", "{618E1C0F-E6B7-4C51-961D-C4ACE60CFC85}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NSBSample", "NSBSample", "{963C0C88-DCB6-4944-94EC-728CBB3C2778}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.Tests", "Extensions\src\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.Tests\Ncqrs.Eventing.Sourcing.Snapshotting.DynamicSnapshot.Tests.csproj", "{85073A89-CC13-44E2-B8C2-FB0B638B60F7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Samples\NSBSample\Client\Client.csproj", "{97B83914-6A1A-4EF4-AE40-F5CE4FA48FA8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands", "Samples\NSBSample\Commands\Commands.csproj", "{5EF85227-BF8E-4A19-8496-2A3BB500E27C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Samples\NSBSample\Domain\Domain.csproj", "{B233A995-93BA-4B6F-8227-EF2A57C750BD}" + ProjectSection(ProjectDependencies) = postProject + {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Events", "Samples\NSBSample\Events\Events.csproj", "{5088657E-AC3F-4081-B0B8-ACFBBD6BFA28}" + ProjectSection(ProjectDependencies) = postProject + {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Samples\NSBSample\Server\Server.csproj", "{E55F2D87-CBA5-48CE-AF6E-FBF069084BAF}" + ProjectSection(ProjectDependencies) = postProject + {01F84441-80D3-49B4-AB18-96894ACB2F90} = {01F84441-80D3-49B4-AB18-96894ACB2F90} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VersioningSample", "VersioningSample", "{E7C55656-EC73-4802-9ED4-1BC321C86ABA}" + ProjectSection(SolutionItems) = preProject + Samples\VersioningSample\CreateEventStore.sql = Samples\VersioningSample\CreateEventStore.sql + Samples\VersioningSample\readme.txt = Samples\VersioningSample\readme.txt + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppV1", "Samples\VersioningSample\src\Appv1\AppV1.csproj", "{ECE2E2E8-648C-4561-82A0-9A1D6A2D4645}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppV2", "Samples\VersioningSample\src\AppV2\AppV2.csproj", "{7A3419B2-588C-416B-A9F3-BFAE77C22D77}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppV3", "Samples\VersioningSample\src\AppV3\AppV3.csproj", "{2489CF5D-6CEE-44C7-825D-521383275DB7}" EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution @@ -653,6 +668,26 @@ Global {85073A89-CC13-44E2-B8C2-FB0B638B60F7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {85073A89-CC13-44E2-B8C2-FB0B638B60F7}.Release|Mixed Platforms.Build.0 = Release|Any CPU {85073A89-CC13-44E2-B8C2-FB0B638B60F7}.Release|x86.ActiveCfg = Release|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Debug|x86.ActiveCfg = Debug|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Release|Any CPU.Build.0 = Release|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {D8D8A477-8018-432B-8E85-795E425D4862}.Release|x86.ActiveCfg = Release|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Debug|x86.ActiveCfg = Debug|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Release|Any CPU.Build.0 = Release|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -691,6 +726,8 @@ Global {73EFEBCC-4B62-470B-A27B-D846359FF600} = {4EAA1C9A-E268-4BA7-A73E-940E3D769C3A} {618E1C0F-E6B7-4C51-961D-C4ACE60CFC85} = {4EAA1C9A-E268-4BA7-A73E-940E3D769C3A} {85073A89-CC13-44E2-B8C2-FB0B638B60F7} = {4EAA1C9A-E268-4BA7-A73E-940E3D769C3A} + {D8D8A477-8018-432B-8E85-795E425D4862} = {4EAA1C9A-E268-4BA7-A73E-940E3D769C3A} + {04D30F12-E5F0-4805-AEA7-F3AB3C3BED8C} = {4EAA1C9A-E268-4BA7-A73E-940E3D769C3A} {8478A8FA-7295-4098-866D-47F458C766C8} = {84A6E29C-BC29-4348-BA51-4218E75CED1A} {963C0C88-DCB6-4944-94EC-728CBB3C2778} = {84A6E29C-BC29-4348-BA51-4218E75CED1A} {E7C55656-EC73-4802-9ED4-1BC321C86ABA} = {84A6E29C-BC29-4348-BA51-4218E75CED1A} diff --git a/Ncqrs.Master.sln.DotSettings b/Ncqrs.Master.sln.DotSettings new file mode 100644 index 00000000..4d64af1d --- /dev/null +++ b/Ncqrs.Master.sln.DotSettings @@ -0,0 +1,2 @@ + + HINT \ No newline at end of file diff --git a/Samples/MyNotes/src/ApplicationService/ApplicationService.csproj b/Samples/MyNotes/src/ApplicationService/ApplicationService.csproj index 6cad1928..a06f6c04 100644 --- a/Samples/MyNotes/src/ApplicationService/ApplicationService.csproj +++ b/Samples/MyNotes/src/ApplicationService/ApplicationService.csproj @@ -105,6 +105,10 @@ + + {D8D8A477-8018-432B-8E85-795E425D4862} + Ncqrs.Eventing.Storage.AWS + {CF0635EB-DFA4-4E82-B245-A0F125183E08} Commands %28Samples\MyNotes\Commands%29 diff --git a/Samples/MyNotes/src/ApplicationService/BootStrapper.cs b/Samples/MyNotes/src/ApplicationService/BootStrapper.cs index c3c6f825..9bf8fafc 100644 --- a/Samples/MyNotes/src/ApplicationService/BootStrapper.cs +++ b/Samples/MyNotes/src/ApplicationService/BootStrapper.cs @@ -1,5 +1,4 @@ -using System.Configuration; -using Commands; +using Commands; using Ncqrs; using Ncqrs.Commanding; using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; @@ -8,7 +7,7 @@ using Ncqrs.EventBus; using Ncqrs.Eventing.ServiceModel.Bus; using Ncqrs.Eventing.Storage; -using Ncqrs.Eventing.Storage.SQL; +using Ncqrs.Eventing.Storage.AWS; using Castle.Windsor; using Castle.MicroKernel.Registration; using Ncqrs.Eventing.Sourcing.Snapshotting; @@ -22,13 +21,10 @@ namespace ApplicationService public static class BootStrapper { - - - public static void BootUp(InMemoryBufferedBrowsableElementStore buffer) + public static void BootUp() { - var connectionString = ConfigurationManager.ConnectionStrings["EventStore"].ConnectionString; - var asd = new MsSqlServerEventStore(connectionString); - var dsa = new MsSqlServerEventStore(connectionString); + var asd = new SimpleDBStore(); + var dsa = new SimpleDBStore(); Assembly asm = Assembly.LoadFrom("Domain.dll"); IWindsorContainer container = new WindsorContainer(); @@ -36,7 +32,7 @@ public static void BootUp(InMemoryBufferedBrowsableElementStore buffer) container.Register( Component.For().ImplementedBy(), Component.For().Instance(InitializeCommandService()), - Component.For().Instance(InitializeEventBus(buffer)), + Component.For().Instance(InitializeEventBus()), Component.For().Forward().Instance(dsa), Component.For().Instance(new AllCommandsInAppDomainEnumerator()), Component.For().AsSnapshotable() @@ -59,12 +55,10 @@ private static ICommandService InitializeCommandService() return service; } - private static IEventBus InitializeEventBus(InMemoryBufferedBrowsableElementStore buffer) + private static IEventBus InitializeEventBus() { var bus = new InProcessEventBus(); - - bus.RegisterHandler(new InMemoryBufferedEventHandler(buffer)); - + return bus; } } diff --git a/Samples/MyNotes/src/ApplicationService/Program.cs b/Samples/MyNotes/src/ApplicationService/Program.cs index 8ed301cd..312dde57 100644 --- a/Samples/MyNotes/src/ApplicationService/Program.cs +++ b/Samples/MyNotes/src/ApplicationService/Program.cs @@ -1,22 +1,9 @@ using System; -using System.Collections.Generic; using System.Configuration; -using System.Linq; using System.ServiceModel; -using System.Text; -using System.Threading; -using ApplicationService.Properties; -using EventStore.Persistence.SqlPersistence; -using EventStore.Serialization; -using Ncqrs; using Ncqrs.CommandService; using Ncqrs.EventBus; using Ncqrs.Eventing.ServiceModel.Bus; -using Ncqrs.Eventing.Sourcing; -using Ncqrs.Eventing.Storage; -using Ncqrs.Eventing.Storage.JOliver; -using Ncqrs.Eventing.Storage.JOliver.SqlPersistence; -using Ncqrs.Eventing.Storage.SQL; namespace ApplicationService { @@ -26,38 +13,18 @@ static class Program static void Main(string[] args) { - GetBrowsableEventStore = GetBuiltInBrowsableElementStore; - var bus = new InProcessEventBus(true); bus.RegisterAllHandlersInAssembly(typeof(Program).Assembly); - var buffer = new InMemoryBufferedBrowsableElementStore(GetBrowsableEventStore(), 20 /*magic number found in ThresholedFetchPolicy*/); - var pipeline = Pipeline.Create("Default", new EventBusProcessor(bus), buffer); - - BootStrapper.BootUp(buffer); + + BootStrapper.BootUp(); var commandServiceHost = new ServiceHost(typeof(CommandWebService)); commandServiceHost.Open(); - pipeline.Start(); + Console.ReadLine(); - pipeline.Stop(); commandServiceHost.Close(); - } - - private static IBrowsableElementStore GetJoesBrowsableElementStore() - { - var factory = new AbsoluteOrderingSqlPersistenceFactory("EventStore", new BinarySerializer(), false); - var store = factory.Build(); - store.Initialize(); - return new JoesBrowsableEventStore(store); - } - - private static IBrowsableElementStore GetBuiltInBrowsableElementStore() - { - var connectionString = ConfigurationManager.ConnectionStrings["EventStore"].ConnectionString; - var browsableEventStore = new MsSqlServerEventStoreElementStore(connectionString); - return browsableEventStore; } } } diff --git a/Samples/MyNotes/src/ApplicationService/app.config b/Samples/MyNotes/src/ApplicationService/app.config index a9b7f846..abdbd96f 100644 --- a/Samples/MyNotes/src/ApplicationService/app.config +++ b/Samples/MyNotes/src/ApplicationService/app.config @@ -1,7 +1,9 @@  - - + + + + @@ -10,15 +12,15 @@ - - - + @@ -38,4 +40,7 @@ - + + + + diff --git a/Samples/MyNotes/src/ReadModel/App.Config b/Samples/MyNotes/src/ReadModel/App.Config index 4e5eb4ed..0a3f67da 100644 --- a/Samples/MyNotes/src/ReadModel/App.Config +++ b/Samples/MyNotes/src/ReadModel/App.Config @@ -1,6 +1,9 @@  - + \ No newline at end of file diff --git a/Samples/MyNotes/src/ReadModel/ReadModel.edmx b/Samples/MyNotes/src/ReadModel/ReadModel.edmx index c664db67..e55e2158 100644 --- a/Samples/MyNotes/src/ReadModel/ReadModel.edmx +++ b/Samples/MyNotes/src/ReadModel/ReadModel.edmx @@ -5,28 +5,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/MyNotes/src/Website/Controllers/NoteController.cs b/Samples/MyNotes/src/Website/Controllers/NoteController.cs index 9270993f..185a7848 100644 --- a/Samples/MyNotes/src/Website/Controllers/NoteController.cs +++ b/Samples/MyNotes/src/Website/Controllers/NoteController.cs @@ -12,7 +12,7 @@ namespace Website.Controllers { public class NoteController : Controller { - private static ChannelFactory _channelFactory; + private static readonly ChannelFactory _channelFactory; static NoteController() { diff --git a/Samples/MyNotes/src/Website/Web.config b/Samples/MyNotes/src/Website/Web.config index 41ec3f79..e22c4eab 100644 --- a/Samples/MyNotes/src/Website/Web.config +++ b/Samples/MyNotes/src/Website/Web.config @@ -6,7 +6,7 @@ - + diff --git a/Samples/MyNotes/src/Website/Website.csproj b/Samples/MyNotes/src/Website/Website.csproj index d11a045c..93b40c43 100644 --- a/Samples/MyNotes/src/Website/Website.csproj +++ b/Samples/MyNotes/src/Website/Website.csproj @@ -14,6 +14,7 @@ Website v4.0 false + false true @@ -164,4 +165,4 @@ - + \ No newline at end of file diff --git a/Samples/NSBSample/Client/ClientEndpoint.cs b/Samples/NSBSample/Client/ClientEndpoint.cs index bfcd15a4..3d913070 100644 --- a/Samples/NSBSample/Client/ClientEndpoint.cs +++ b/Samples/NSBSample/Client/ClientEndpoint.cs @@ -1,6 +1,5 @@ using System; using Commands; -using Events; using Ncqrs.Commanding; using Ncqrs.NServiceBus; using NServiceBus; @@ -18,7 +17,7 @@ public void Run() Console.WriteLine("Press 'Enter' to send a message to create a new Aggregate.To exit, Ctrl + C"); Console.ReadLine(); - Bus.Send("ServerQueue", new CommandMessage { Payload = new CreateSomeObjectCommand () }); + Bus.Send("ServerQueue", new CommandMessage { Payload = new CreateSomeObjectCommand() }); string line; while ((line = Console.ReadLine()) != null) diff --git a/Samples/NSBSample/Commands/DoSomethingCommand.cs b/Samples/NSBSample/Commands/DoSomethingCommand.cs index 3b18ce4e..cc134022 100644 --- a/Samples/NSBSample/Commands/DoSomethingCommand.cs +++ b/Samples/NSBSample/Commands/DoSomethingCommand.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Domain; using Ncqrs.Commanding; using Ncqrs.Commanding.CommandExecution.Mapping.Attributes; diff --git a/Samples/NSBSample/Domain/SomeDomainObject.cs b/Samples/NSBSample/Domain/SomeDomainObject.cs index c08efa68..c0174598 100644 --- a/Samples/NSBSample/Domain/SomeDomainObject.cs +++ b/Samples/NSBSample/Domain/SomeDomainObject.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Events; using Ncqrs.Domain; @@ -11,21 +8,25 @@ public class SomeDomainObject : AggregateRootMappedByConvention { private string _value; - public string Value + public SomeDomainObject(int dummyValue) { - get { return _value; } + Console.WriteLine("SomeDomainObject with ID={0} created!", EventSourceId); + ApplyEvent(new SomeDomainObjectCreatedEvent {ObjectId = EventSourceId}); } - public SomeDomainObject(int dummyValue) + public SomeDomainObject() { - Console.WriteLine("SomeDomainObject with ID={0} created!", EventSourceId); - ApplyEvent(new SomeDomainObjectCreatedEvent() { ObjectId = EventSourceId }); + } + + public string Value + { + get { return _value; } } public void DoSomething(string value) { Console.WriteLine("Calling DoSomething on SomeDomainObject with ID={0}", EventSourceId); - ApplyEvent(new SomePropertyChangedEvent { Value = value }); + ApplyEvent(new SomePropertyChangedEvent {Value = value}); } private void OnSomePropertyChangedEvent(SomePropertyChangedEvent @event) @@ -34,11 +35,7 @@ private void OnSomePropertyChangedEvent(SomePropertyChangedEvent @event) } private void OnSomeDomainObjectCreatedEvent(SomeDomainObjectCreatedEvent @event) - { - } - - public SomeDomainObject() { } } -} +} \ No newline at end of file diff --git a/Samples/NSBSample/Server/EndpointConfig.cs b/Samples/NSBSample/Server/EndpointConfig.cs index 315faf61..cea3ddad 100644 --- a/Samples/NSBSample/Server/EndpointConfig.cs +++ b/Samples/NSBSample/Server/EndpointConfig.cs @@ -1,5 +1,4 @@ -using System; -using NServiceBus; +using NServiceBus; namespace Server { diff --git a/lib/ThirdParty/AWSSDK/AWSSDK.dll b/lib/ThirdParty/AWSSDK/AWSSDK.dll new file mode 100644 index 00000000..427ae391 Binary files /dev/null and b/lib/ThirdParty/AWSSDK/AWSSDK.dll differ