Skip to content

Instantly share code, notes, and snippets.

@ryankelley
Created June 3, 2010 21:15
Show Gist options
  • Select an option

  • Save ryankelley/424504 to your computer and use it in GitHub Desktop.

Select an option

Save ryankelley/424504 to your computer and use it in GitHub Desktop.
public interface IMessage
{
Guid Id { get; set; }
}
[Serializable]
public class EntityCreatedMessage : IMessage
{
public Guid Id { get; set; }
public Type EntityType { get; set; }
public Guid EntityId { get; set; }
public DateTime CreatedTime { get; set; }
public EntityCreatedMessage(DomainEntity entity)
{
EntityType = entity.GetType();
EntityId = entity.Id;
CreatedTime = entity.Created;
Id = Guid.NewGuid();
}
}
public class RulesEngine : IRulesEngine, Consumes<IMessage>.All
{
public void Consume(IMessage message)
{
ProcessMessage(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment