Last active
November 19, 2015 18:20
-
-
Save jeremiahredekop/f57fc89396019215dac7 to your computer and use it in GitHub Desktop.
Revisions
-
jeremiahredekop revised this gist
Nov 19, 2015 . 1 changed file with 24 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,26 @@ using Paramol.SqlClient; using Projac; namespace Sample { public static class PortfolioProjectionUsingBuilder { public static readonly AnonymousSqlProjection Instance = new AnonymousSqlProjectionBuilder(). When<PortfolioAdded>(@event => TSql.NonQueryStatement( "INSERT INTO [Portfolio] (Id, Name) VALUES (@P1, @P2)", new { P1 = TSql.Int(@event.Id), P2 = TSql.NVarChar(@event.Name, 40) } )). When<PortfolioRemoved>(@event => TSql.NonQueryStatement( "DELETE FROM [Portfolio] WHERE Id = @P1", new { P1 = TSql.Int(@event.Id) } )). When<PortfolioRenamed>(@event => TSql.NonQueryStatement( "UPDATE [Portfolio] SET Name = @P2 WHERE Id = @P1", new { P1 = TSql.Int(@event.Id), P2 = TSql.NVarChar(@event.Name, 40) } )). Build(); } } -
jeremiahredekop created this gist
Nov 19, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ public static class PortfolioProjectionUsingBuilder { public static readonly AnonymousSqlProjection Instance = new AnonymousSqlProjectionBuilder(). When<PortfolioAdded>(@event => TSql.NonQueryStatement( "INSERT INTO [Portfolio] (Id, Name) VALUES (@P1, @P2)", new { P1 = TSql.Int(@event.Id), P2 = TSql.NVarChar(@event.Name, 40) } )). When<PortfolioRemoved>(@event => TSql.NonQueryStatement( "DELETE FROM [Portfolio] WHERE Id = @P1", new { P1 = TSql.Int(@event.Id) } )). When<PortfolioRenamed>(@event => TSql.NonQueryStatement( "UPDATE [Portfolio] SET Name = @P2 WHERE Id = @P1", new { P1 = TSql.Int(@event.Id), P2 = TSql.NVarChar(@event.Name, 40) } )). Build(); }