Ver a proveniência

refactor

master
yangxiaodong há 7 anos
ascendente
cometimento
73556221b3
2 ficheiros alterados com 21 adições e 3 eliminações
  1. +2
    -2
      src/Cap.Consistency.EntityFrameworkCore/ConsistencyEntityFrameworkBuilderExtensions.cs
  2. +19
    -1
      src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessageStore.cs

+ 2
- 2
src/Cap.Consistency.EntityFrameworkCore/ConsistencyEntityFrameworkBuilderExtensions.cs Ver ficheiro

@@ -1,5 +1,5 @@
using Cap.Consistency.EntityFrameworkCore;
using Cap.Consistency.Store;
using Cap.Consistency;
using Cap.Consistency.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Microsoft.Extensions.DependencyInjection


+ 19
- 1
src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessageStore.cs Ver ficheiro

@@ -1,8 +1,8 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Cap.Consistency.Infrastructure;
using Cap.Consistency.Store;
using Microsoft.EntityFrameworkCore;

namespace Cap.Consistency.EntityFrameworkCore
@@ -126,6 +126,24 @@ namespace Cap.Consistency.EntityFrameworkCore
return OperateResult.Success;
}

public Task<ConsistencyMessage> GetFirstEnqueuedMessageAsync(CancellationToken cancellationToken) {
cancellationToken.ThrowIfCancellationRequested();
return MessageSet.AsNoTracking().Where(x => x.Status == MessageStatus.WaitForSend).FirstOrDefaultAsync(cancellationToken);
}

//public void ChangeState(ConsistencyMessage message, MessageStatus status) {
// Context.Attach(message);
// message.Status = status;
// Context.Update(message);
// try {
// await SaveChanges(cancellationToken);
// }
// catch (DbUpdateConcurrencyException ex) {
// return OperateResult.Failed(new OperateError() { Code = "DbUpdateConcurrencyException", Description = ex.Message });
// }
// return OperateResult.Success;
//}

/// <summary>
/// Gets or sets a flag indicating if changes should be persisted after CreateAsync, UpdateAsync and DeleteAsync are called.
/// </summary>


Carregando…
Cancelar
Guardar