public CouchConveyEntry(string id, T entity, string json = null, bool overwrite = true, CouchConveyorEventHandler <T> handler = null) { this.Id = id; this.Hash = id.GetHashCode(); this.Entity = entity; this.Json = json; this.Overwrite = overwrite; this.Handler = handler ?? CouchConveyorEventHandler <T> .Default; this.TimeStamp = DateTime.UtcNow; }
public InstantCouchConveyorEventHandler(CouchConveyorEventHandler <T> .StoredEventHandler on_stored = null, CouchConveyorEventHandler <T> .FailedEventHandler on_failed = null) { if (on_stored != null) { this.OnStoredEvent += on_stored; } if (on_failed != null) { this.OnFailedEvent += on_failed; } }
public void Convey(string id, T value, CouchConveyorEventHandler <T> handler = null) { string json = (value != null)? Serialize(value): null; // Serialize on synchronized context to store 'as-is' status this.AddEntry(new CouchConveyEntry <T>(id, value, json, true, handler), -1); // find best method to call this. Current method AddEntry can block }