Skip to content

Instantly share code, notes, and snippets.

@ToJans
Created April 26, 2014 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ToJans/11323282 to your computer and use it in GitHub Desktop.
Save ToJans/11323282 to your computer and use it in GitHub Desktop.
var specification =
TSql.Projection().
When<PortfolioAdded>(@event =>
TSql.NonQuery(
"INSERT INTO [Portfolio] (Id, Name) VALUES ({0}, {1})",
TSql.Int(@event.Id), TSql.NVarChar(@event.Name, 40)
).
When<PortfolioRemoved>(@event =>
TSql.NonQuery(
"DELETE FROM [Portfolio] WHERE Id = {0}",
TSql.Int(@event.Id)
).
When<PortfolioRenamed>(@event =>
TSql.NonQuery(
"UPDATE [Portfolio] SET Name = {0} WHERE Id = {1}",
TSql.Int(@event.Id), TSql.NVarChar(@event.Name, 40)
).
Build();
@ToJans
Copy link
Author

ToJans commented Apr 26, 2014

or, you could use @0, @1 etc as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment