Browse Source

Merge branch 'dev' of https://github.com/dotnet/eShopOnContainers into dev

pull/133/head
Ramón Tomás 7 years ago
parent
commit
a07207a7b7
3 changed files with 14 additions and 3 deletions
  1. +3
    -0
      src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs
  2. +10
    -2
      src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
  3. +1
    -1
      test/Services/FunctionalTests/Services/Catalog/CatalogScenariosBase.cs

+ 3
- 0
src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs View File

@ -130,6 +130,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
return Ok(items);
}
//POST api/v1/[controller]/edit
[Route("edit")]
[HttpPost]
public async Task<IActionResult> EditProduct([FromBody]CatalogItem product)
@ -164,6 +165,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
return Ok();
}
//POST api/v1/[controller]/create
[Route("create")]
[HttpPost]
public async Task<IActionResult> CreateProduct([FromBody]CatalogItem product)
@ -184,6 +186,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
return Ok();
}
//DELETE api/v1/[controller]/id
[Route("{id}")]
[HttpDelete]
public async Task<IActionResult> DeleteProduct(int id)


+ 10
- 2
src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs View File

@ -237,10 +237,18 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
public async Task<int> SaveEntitiesAsync(CancellationToken cancellationToken = default(CancellationToken))
{
// Dispatch Domain Events collection.
// Choices:
// A) Right BEFORE committing data (EF SaveChanges) into the DB will make a single transaction including
// side effects from the domain event handlers which are using the same DbContext with "InstancePerLifetimeScope" or "scoped" lifetime
// B) Right AFTER committing data (EF SaveChanges) into the DB will make multiple transactions.
// You will need to handle eventual consistency and compensatory actions in case of failures in any of the Handlers.
await _mediator.DispatchDomainEventsAsync(this);
// After executing this line all the changes performed thought the DbContext will be commited
var result = await base.SaveChangesAsync();
// Dispatch the Domain Events collection right after saving/committing data into the database
await _mediator.DispatchDomainEventsAsync(this);
return result;
}
}


+ 1
- 1
test/Services/FunctionalTests/Services/Catalog/CatalogScenariosBase.cs View File

@ -34,7 +34,7 @@ namespace FunctionalTests.Services.Catalog
public static class Post
{
public static string UpdateCatalogProduct = "api/v1/catalog";
public static string UpdateCatalogProduct = "api/v1/catalog/edit";
}
}
}

Loading…
Cancel
Save