Skip to content

Commit a88fbf3

Browse files
Minor clean-up in Ordering Context
1 parent 625f532 commit a88fbf3

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderEntityTypeConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace 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>()

src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,14 @@
1212

1313
namespace 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();

0 commit comments

Comments
 (0)