File tree Expand file tree Collapse file tree
src/Services/Ordering/Ordering.Infrastructure Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88namespace Ordering . Infrastructure . EntityConfigurations
99{
10- class OrderEntityTypeConfiguration
11- : IEntityTypeConfiguration < Order >
10+ class OrderEntityTypeConfiguration : IEntityTypeConfiguration < Order >
1211 {
1312 public void Configure ( EntityTypeBuilder < Order > orderConfiguration )
1413 {
@@ -21,6 +20,7 @@ public void Configure(EntityTypeBuilder<Order> orderConfiguration)
2120 orderConfiguration . Property ( o => o . Id )
2221 . ForSqlServerUseSequenceHiLo ( "orderseq" , OrderingContext . DEFAULT_SCHEMA ) ;
2322
23+ //Address value object persisted as owned entity type supported since EF Core 2.0
2424 orderConfiguration . OwnsOne ( o => o . Address ) ;
2525
2626 orderConfiguration . Property < DateTime > ( "OrderDate" ) . IsRequired ( ) ;
@@ -32,7 +32,7 @@ public void Configure(EntityTypeBuilder<Order> orderConfiguration)
3232 var navigation = orderConfiguration . Metadata . FindNavigation ( nameof ( Order . OrderItems ) ) ;
3333
3434 // DDD Patterns comment:
35- //Set as Field (New since EF 1.1) to access the OrderItem collection property through its field
35+ //Set as field (New since EF 1.1) to access the OrderItem collection property through its field
3636 navigation . SetPropertyAccessMode ( PropertyAccessMode . Field ) ;
3737
3838 orderConfiguration . HasOne < PaymentMethod > ( )
Original file line number Diff line number Diff line change 1212
1313namespace Microsoft . eShopOnContainers . Services . Ordering . Infrastructure
1414{
15- public class OrderingContext
16- : DbContext , IUnitOfWork
17-
15+ public class OrderingContext : DbContext , IUnitOfWork
1816 {
1917 public const string DEFAULT_SCHEMA = "ordering" ;
20-
2118 public DbSet < Order > Orders { get ; set ; }
22-
2319 public DbSet < OrderItem > OrderItems { get ; set ; }
24-
2520 public DbSet < PaymentMethod > Payments { get ; set ; }
26-
2721 public DbSet < Buyer > Buyers { get ; set ; }
28-
2922 public DbSet < CardType > CardTypes { get ; set ; }
30-
3123 public DbSet < OrderStatus > OrderStatus { get ; set ; }
3224
3325 private readonly IMediator _mediator ;
@@ -63,7 +55,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
6355 // You will need to handle eventual consistency and compensatory actions in case of failures in any of the Handlers.
6456 await _mediator . DispatchDomainEventsAsync ( this ) ;
6557
66-
6758 // After executing this line all the changes (from the Command Handler and Domain Event Handlers)
6859 // performed throught the DbContext will be commited
6960 var result = await base . SaveChangesAsync ( ) ;
You can’t perform that action at this time.
0 commit comments