Updated relevant packages in ordering.infrastructure project
This commit is contained in:
		
							parent
							
								
									c007047291
								
							
						
					
					
						commit
						301913df45
					
				| @ -1,28 +1,21 @@ | |||||||
| using MediatR; | namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; | ||||||
| using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; |  | ||||||
| using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Ordering.Infrastructure | static class MediatorExtension | ||||||
| { | { | ||||||
|     static class MediatorExtension |     public static async Task DispatchDomainEventsAsync(this IMediator mediator, OrderingContext ctx) | ||||||
|     { |     { | ||||||
|         public static async Task DispatchDomainEventsAsync(this IMediator mediator, OrderingContext ctx) |         var domainEntities = ctx.ChangeTracker | ||||||
|         { |             .Entries<Entity>() | ||||||
|             var domainEntities = ctx.ChangeTracker |             .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any()); | ||||||
|                 .Entries<Entity>() |  | ||||||
|                 .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any()); |  | ||||||
| 
 | 
 | ||||||
|             var domainEvents = domainEntities |         var domainEvents = domainEntities | ||||||
|                 .SelectMany(x => x.Entity.DomainEvents) |             .SelectMany(x => x.Entity.DomainEvents) | ||||||
|                 .ToList(); |             .ToList(); | ||||||
| 
 | 
 | ||||||
|             domainEntities.ToList() |         domainEntities.ToList() | ||||||
|                 .ForEach(entity => entity.Entity.ClearDomainEvents()); |             .ForEach(entity => entity.Entity.ClearDomainEvents()); | ||||||
| 
 | 
 | ||||||
|             foreach (var domainEvent in domainEvents) |         foreach (var domainEvent in domainEvents) | ||||||
|                 await mediator.Publish(domainEvent); |             await mediator.Publish(domainEvent); | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,9 +11,9 @@ | |||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="MediatR" Version="9.0.0" /> |     <PackageReference Include="MediatR" Version="9.0.0" /> | ||||||
|     <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" /> |     <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" /> | ||||||
|     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" /> |     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-preview.7.21378.4" /> | ||||||
|     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" /> |     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0-preview.7.21378.4" /> | ||||||
|     <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" /> |     <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0-preview.7.21377.19" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user