public static IEnumerable <object> Project(ItemPurchased purchased, Guid nextEventId, int checkpointPosition)
        {
            yield return(TSql.NonQueryStatement(@"insert into ItemsPurchased (StockKeepingUnit) values (@StockKeepingUnit)", new
            {
                StockKeepingUnit = TSql.VarCharMax(purchased.StockKeepingUnit)
            }));

            yield return(TSql.NonQueryStatement(@"insert into StreamCheckpoint (Position) values (@Position)", new
            {
                Position = TSql.Int(checkpointPosition)
            }));

            yield return(new WriteToStream(nextEventId, "egress", new CheckpointEvent(checkpointPosition)));
        }
 public PortfolioProjection()
 {
     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) }
                                 ));
 }
예제 #3
0
 public void IntNullReturnsExpectedInstance()
 {
     Assert.That(TSql.Int(null), Is.EqualTo(TSqlIntNullValue.Instance));
 }
예제 #4
0
 public void IntReturnsExpectedInstance()
 {
     Assert.That(TSql.Int(123), Is.EqualTo(new TSqlIntValue(123)));
 }