Skip to content

Commit

Permalink
Merge pull request pjvds#74 from cgallegu/master
Browse files Browse the repository at this point in the history
Making VersioningSample work out of the box.
  • Loading branch information
pjvds committed Aug 16, 2011
2 parents 577ee22 + abb9582 commit 454ee50
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Ncqrs.Master.sln
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion Samples/VersioningSample/CreateEventStore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CREATE TABLE [dbo].[Events]
[EventSourceId] [uniqueidentifier] NOT NULL,
[Sequence] [bigint],

[Data] [varbinary](max) NOT NULL
[Data] [varchar](max) NOT NULL
) ON [PRIMARY]
GO

Expand Down
3 changes: 3 additions & 0 deletions Samples/VersioningSample/src/AppV2/AppV2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\lib\ThirdParty\json.net\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
Expand Down
5 changes: 4 additions & 1 deletion Samples/VersioningSample/src/AppV2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Ncqrs.Eventing.Storage;
using Ncqrs.Eventing.Storage.Serialization;
using Ncqrs.Eventing.Storage.SQL;
using AwesomeAppRefactored.Events;

namespace AwesomeAppRefactored
{
Expand All @@ -24,13 +25,15 @@ static void Main(string[] args)
commandService.Execute(new ChangeNameCommand(id, "Jane", "Doe"));

Console.WriteLine("If you see this message and no exception occurred, it had probably worked. Now you can run AppV3.");
Console.WriteLine("Press any key to continue");
Console.ReadLine();
}

private static IEventStore InitializeEventStore()
{
var typeResolver = new AttributeEventTypeResolver();
typeResolver.AddAllEventsInAssembly(typeof(Program).Assembly);
typeResolver.AddEvent(typeof(NameChangedEvent));
typeResolver.AddEvent(typeof(PersonCreatedEvent));

var eventStore = new MsSqlServerEventStore(ConfigurationManager.ConnectionStrings["EventStore"].ConnectionString, typeResolver, null);
return eventStore;
Expand Down
1 change: 1 addition & 0 deletions Samples/VersioningSample/src/AppV3/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static void Main(string[] args)
commandService.Execute(new ChangeNameCommand(id, "Jane Smith Doe"));

Console.WriteLine("If you see this message and no exception occurred, it had probably worked. You are all clear now!");
Console.WriteLine("Press any key to continue");
Console.ReadKey(true);
}

Expand Down
3 changes: 3 additions & 0 deletions Samples/VersioningSample/src/Appv1/AppV1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\lib\ThirdParty\json.net\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
Expand Down
5 changes: 4 additions & 1 deletion Samples/VersioningSample/src/Appv1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Ncqrs.Commanding.ServiceModel;
using Ncqrs.Eventing.Storage;
using Ncqrs.Eventing.Storage.SQL;
using AwesomeApp.Events;

namespace AwesomeApp
{
Expand All @@ -24,13 +25,15 @@ static void Main(string[] args)
commandService.Execute(new ChangeNameCommand(id, "Jane", "Smith"));

Console.WriteLine("If you see this message and no exception occurred, it had probably worked. Now you can run AppV2.");
Console.WriteLine("Press any key to continue");
Console.ReadKey(true);
}

private static IEventStore InitializeEventStore()
{
var typeResolver = new AttributeEventTypeResolver();
typeResolver.AddAllEventsInAssembly(typeof(Program).Assembly);
typeResolver.AddEvent(typeof(NameChangedEventttt));
typeResolver.AddEvent(typeof(PersonCreatedEvent));

var eventStore = new MsSqlServerEventStore(ConfigurationManager.ConnectionStrings["EventStore"].ConnectionString, typeResolver, null);
return eventStore;
Expand Down

0 comments on commit 454ee50

Please sign in to comment.