Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement