本文整理汇总了C#中ICommit类的典型用法代码示例。如果您正苦于以下问题:C# ICommit类的具体用法?C# ICommit怎么用?C# ICommit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICommit类属于命名空间,在下文中一共展示了ICommit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostCommit
public override void PostCommit(ICommit committed)
{
if (committed != null)
{
_scheduler.ScheduleDispatch(committed);
}
}
示例2: ValidateCommitStamp
private void ValidateCommitStamp(ICommit commit)
{
if (commit.CommitStamp.AddSeconds(-2) > CommitStampProcessed)
{
throw new Exception(string.Format("Commit {0} {1} marked with checkpoint can not be found", CommitIdProcessed, CommitStampProcessed));
}
}
示例3: Select
public override ICommit Select(ICommit committed)
{
bool converted = false;
var eventMessages = committed
.Events
.Select(eventMessage =>
{
object convert = Convert(eventMessage.Body);
if (ReferenceEquals(convert, eventMessage.Body))
{
return eventMessage;
}
converted = true;
return new EventMessage { Headers = eventMessage.Headers, Body = convert };
})
.ToList();
if (!converted)
{
return committed;
}
return new Commit(committed.BucketId,
committed.StreamId,
committed.StreamRevision,
committed.CommitId,
committed.CommitSequence,
committed.CommitStamp,
committed.CheckpointToken,
committed.Headers,
eventMessages);
}
示例4: Dispatch
public void Dispatch(ICommit commit)
{
foreach (var e in commit.Events.Select(x=>x.Body))
{
EventPublisher.Publish(e as IEvent);
}
}
示例5: Save
public void Save(ICommit commit) {
if (commit == null)
throw new ArgumentNullException("commit");
var id = Serializer.Serialize(commit.Id);
var value = Serializer.Serialize(commit);
using (var connection = DbConnectionFactory.CreateOpenConnection())
using (var trans = connection.BeginTransaction(IsolationLevel.Serializable))
using (var command = connection.CreateCommand()) {
command.Transaction = trans;
command.CommandText = "INSERT INTO SqlCommits (Id, Value) VALUES (@Id, @Value)";
command.Parameters.Add(command.CreateParameter());
command.Parameters[0].ParameterName = "Id";
command.Parameters[0].Value = id;
command.Parameters.Add(command.CreateParameter());
command.Parameters[1].ParameterName = "Value";
command.Parameters[1].Value = value;
if (command.ExecuteNonQuery() == 0)
throw new InvalidOperationException("Failed to insert a row");
trans.Commit();
}
}
示例6: DispatchCommit
public static void DispatchCommit(IPublisher bus, ICommit commit)
{
foreach (var @event in commit.Events)
{
bus.Publish(@event.Body);
}
}
示例7: Apply
public void Apply(ICommit commit) {
foreach (var addObject in commit.AddedPocos) {
Server.MetaStore.AddNew(addObject.Meta);
Server.IndexManager.NotifyMetaChange(addObject.Meta);
}
foreach (var propertySet in commit.UpdatedPocos) {
var meta = Server.MetaStore.GetWritable(propertySet.Key);
foreach (var setProperty in propertySet) {
meta.Properties[setProperty.Property] = setProperty.Value;
}
Server.MetaStore.Update(meta);
}
foreach (var addToCollection in commit.CollectionAdditions) {
var meta = Server.MetaStore.GetWritable(addToCollection.CollectionId);
meta.Collection.Add(addToCollection.Value);
Server.MetaStore.Update(meta);
}
foreach (var removeFromCollection in commit.CollectionRemovals) {
var meta = Server.MetaStore.GetWritable(removeFromCollection.CollectionId);
meta.Collection.Remove(removeFromCollection.Value);
Server.MetaStore.Update(meta);
}
}
示例8: Dispatch
public void Dispatch(ICommit commit)
{
foreach (var eventMessage in commit.Events)
{
var msg = (IMessage) eventMessage.Body;
_bus.Publish(msg);
}
}
示例9: ScheduleDispatch
public override void ScheduleDispatch(ICommit commit)
{
if (!Started)
{
throw new InvalidOperationException(Messages.SchedulerNotStarted);
}
Logger.Info(Resources.SchedulingDelivery, commit.CommitId);
_queue.Add(commit);
}
示例10: OnNext
public void OnNext(ICommit value)
{
foreach (var ev in value.Events)
{
var @event = ConvertEventMessageToEvent(ev);
Send(@event);
}
}
示例11: CommitModel
public CommitModel(ICommit commit)
{
this.Sequence = commit.CommitSequence;
this.CheckPoint = commit.CheckpointToken;
this.Date = commit.CommitStamp;
this.CommitId = commit.CommitId;
this.Headers = commit.Headers;
Events = commit.Events.ToList();
}
示例12: ScheduleDispatch
public virtual void ScheduleDispatch(ICommit commit)
{
if (!Started)
{
throw new InvalidOperationException(Messages.SchedulerNotStarted);
}
DispatchImmediately(commit);
MarkAsDispatched(commit);
}
示例13: PostCommit
public override void PostCommit(ICommit committed)
{
Logger.DebugFormat(
"New commit {0} on tenant {1}",
committed.CheckpointToken,
TenantAccessor.Current.Id
);
Updater.Update();
}
示例14: Dispatch
public void Dispatch(ICommit commit)
{
foreach (var header in commit.Headers)
{
if (header.Key.StartsWith("UndispatchedMessage."))
{
_bus.Send(header.Value);
}
}
}
示例15: Select
public ICommit Select(ICommit committed)
{
var eventConversionRunner = _eventConversionRunnerFactory();
foreach (var eventMessage in committed.Events)
{
eventMessage.Body = eventConversionRunner.Run(eventMessage.Body);
}
return committed;
}