Skip to content

Instantly share code, notes, and snippets.

@yreynhout
Created August 29, 2012 17:15
Show Gist options
  • Save yreynhout/3515757 to your computer and use it in GitHub Desktop.
Save yreynhout/3515757 to your computer and use it in GitHub Desktop.
Sample 1 - after
public class CurrentPortfolioProjection :
IHandle<AddedRealtyToPortfolio>,
IHandle<RemovedRealtyFromPortfolio> {
IProjectionSqlOperations<CurrentPortfolioEntry> _operations;
public CurrentPortfolioProjection(IProjectionSqlOperations<CurrentPortfolioEntry> operations) {
_operations = operations;
}
public void Handle(AddedRealtyToPortfolio @event) {
_operations.Insert(
new CurrentPortfolioEntry(
@event.PortfolioId, @event.RealtyId,
@event.RealtySummary, @event.RealtySlideshowUrl,
@event.RealtyPropertySheetUrl, @event.RealtyFloorPlanUrl));
}
public void Handle(RemovedRealtyFromPortfolio @event) {
_operations.Delete(entry =>
entry.PortfolioId == @event.PortfolioId &&
entry.RealtyId == @event.RealtyId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment