Skip to content

Instantly share code, notes, and snippets.

@agross
Created June 15, 2010 22:51
Show Gist options
  • Save agross/439866 to your computer and use it in GitHub Desktop.
Save agross/439866 to your computer and use it in GitHub Desktop.
public class DeathCaseCreatedSyncListener : IPostInsertEventListener
{
readonly IContributeDeathCaseDetails[] _properties;
readonly ISyncService _syncService;
public DeathCaseCreatedSyncListener(ISyncService syncService,
IContributeDeathCaseDetails[] properties)
{
_syncService = syncService;
_properties = properties;
}
public void OnPostInsert(PostInsertEvent @event)
{
var deathCase = @event.Entity as DeathCase;
if (deathCase != null)
{
SendDeathCaseCreationSyncEvent(deathCase);
}
}
void SendDeathCaseCreationSyncEvent(DeathCase deathCase)
{
var message = new DeathCaseCreatedMessage();
_properties.Each(x => x.Apply(deathCase, message));
_syncService.DeathCaseUpdated(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment