public ItemModule(IItemAdapter itemAdapter) : base("/data/aggregates") { this.Put("/{itemId}", async(parameters) => { return(await this.Request.ProcessCommand( async(bodyAsObject, bodyAsDictionary, expectedVersion) => await itemAdapter.ChangeAggregate( Guid.Parse(parameters.itemId.ToString()), bodyAsObject.Aggregate.ToString(), Guid.Parse(bodyAsObject.AuthorId.ToString()), expectedVersion ), (ex, hsc) => { // TODO: immediately cause calling Polly to fail (handle specific failure http code to signal "it's not worth retrying"?) // i.e. there is an issue with the data HttpStatusCode result = hsc; if (ex is ConcurrencyException) { result = HttpStatusCode.Conflict; } return result; }, Array.Empty <string>(), "Aggregate", "AuthorId" )); } ); }
public static IItemProvider CreateItemProviderWithoutNewsItemRoot() { var itemProviderMock = new Mock <IItemProvider>(); IItemAdapter nullNewsRootItem = null; itemProviderMock.Setup(mock => mock.SelectSingleItem(It.IsAny <string>())) .Returns(nullNewsRootItem); return(itemProviderMock.Object); }
public ListAdapter(IList list, IItemAdapter adapter) { this.list = list; base.SetItemAdapter(adapter); }
public void InitItemAdapter(IItemAdapter itemAdapter) { Adapter = itemAdapter; }
//设置Item适配器 public void SetItemAdapter(IItemAdapter adapter) { itemAdapter = adapter; }
public void InitItemAdapter(IItemAdapter itemAdapter) { Adapter = itemAdapter; }