Browse Source

Fixed IOrderingServiceDbContext missing implementation

pull/51/head
Galip Tolga Erdem 4 years ago
parent
commit
01d11dabd8
  1. 7
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/IOrderingServiceDbContext.cs
  2. 20
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/OrderingServiceDbContext.cs

7
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/IOrderingServiceDbContext.cs

@ -1,4 +1,7 @@
using Volo.Abp.Data; using EShopOnAbp.OrderingService.Buyers;
using EShopOnAbp.OrderingService.Orders;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
namespace EShopOnAbp.OrderingService.EntityFrameworkCore namespace EShopOnAbp.OrderingService.EntityFrameworkCore
@ -9,5 +12,7 @@ namespace EShopOnAbp.OrderingService.EntityFrameworkCore
/* Add DbSet for each Aggregate Root here. Example: /* Add DbSet for each Aggregate Root here. Example:
* DbSet<Question> Questions { get; } * DbSet<Question> Questions { get; }
*/ */
DbSet<Buyer> Buyers { get; }
DbSet<Order> Orders { get; }
} }
} }

20
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/OrderingServiceDbContext.cs

@ -9,8 +9,7 @@ using Volo.Abp.EntityFrameworkCore.Modeling;
namespace EShopOnAbp.OrderingService.EntityFrameworkCore namespace EShopOnAbp.OrderingService.EntityFrameworkCore
{ {
[ConnectionStringName(OrderingServiceDbProperties.ConnectionStringName)] [ConnectionStringName(OrderingServiceDbProperties.ConnectionStringName)]
public class OrderingServiceDbContext : public class OrderingServiceDbContext : AbpDbContext<OrderingServiceDbContext>, IOrderingServiceDbContext
AbpDbContext<OrderingServiceDbContext>
{ {
public virtual DbSet<Buyer> Buyers { get; set; } public virtual DbSet<Buyer> Buyers { get; set; }
public virtual DbSet<Order> Orders { get; set; } public virtual DbSet<Order> Orders { get; set; }
@ -43,10 +42,7 @@ namespace EShopOnAbp.OrderingService.EntityFrameworkCore
{ {
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "Orders", OrderingServiceDbProperties.DbSchema); b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "Orders", OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props b.ConfigureByConvention(); //auto configure for the base class props
b.OwnsOne(o => o.Address, a => b.OwnsOne(o => o.Address, a => { a.WithOwner(); });
{
a.WithOwner();
});
b.Property<int>("_orderStatusId").UsePropertyAccessMode(PropertyAccessMode.Field) b.Property<int>("_orderStatusId").UsePropertyAccessMode(PropertyAccessMode.Field)
.HasColumnName("OrderStatusId") .HasColumnName("OrderStatusId")
.IsRequired(); .IsRequired();
@ -84,12 +80,12 @@ namespace EShopOnAbp.OrderingService.EntityFrameworkCore
b.ConfigureByConvention(); //auto configure for the base class props b.ConfigureByConvention(); //auto configure for the base class props
b.Property<Guid>("OrderId").IsRequired(); b.Property<Guid>("OrderId").IsRequired();
b.Property(q=>q.ProductId).IsRequired(); b.Property(q => q.ProductId).IsRequired();
b.Property(q=>q.ProductName).IsRequired(); b.Property(q => q.ProductName).IsRequired();
b.Property(q=>q.Discount).IsRequired(); b.Property(q => q.Discount).IsRequired();
b.Property(q=>q.UnitPrice).IsRequired(); b.Property(q => q.UnitPrice).IsRequired();
b.Property(q=>q.Units).IsRequired(); b.Property(q => q.Units).IsRequired();
b.Property(q=>q.PictureUrl).IsRequired(false); b.Property(q => q.PictureUrl).IsRequired(false);
}); });
} }
} }

Loading…
Cancel
Save