Changeset 9579 for branches/OaaS/HeuristicLab.Services.Optimization.Billing
- Timestamp:
- 06/04/13 14:57:46 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Billing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingContext.cs
r9577 r9579 13 13 public DbSet<Invoice> Invoices { get; set; } 14 14 public DbSet<InvoiceLine> InvoiceLines { get; set; } 15 public DbSet<UsageRecord> UsageRecords { get; set; } 15 16 16 17 // enum PaymentMethod … … 33 34 modelBuilder.Configurations.Add(new InvoiceLineConfiguration()); 34 35 modelBuilder.Configurations.Add(new UsageRecordConfiguration()); 35 modelBuilder.Configurations.Add(new UsageRecordLineConfiguration());36 36 37 37 modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>(); … … 45 45 internal OrderConfiguration() { 46 46 this.HasRequired(o => o.User).WithMany().HasForeignKey(o => o.UserId); 47 //this.HasMany<Invoice>(o => o.Invoices).WithRequired().HasForeignKey(i => i.OrderId);48 47 // TODO: OrderState? 49 48 } … … 52 51 private class OrderLineConfiguration : EntityTypeConfiguration<OrderLine> { 53 52 internal OrderLineConfiguration() { 54 this.HasRequired(ol => ol.Order).WithMany( ).HasForeignKey(ol => ol.OrderId);53 this.HasRequired(ol => ol.Order).WithMany(o => o.OrderLines).HasForeignKey(ol => ol.OrderId).WillCascadeOnDelete(true); 55 54 this.HasRequired(ol => ol.Product).WithMany().HasForeignKey(ol => ol.ProductId); 56 55 } … … 60 59 internal InvoiceConfiguration() { 61 60 this.HasRequired(i => i.User).WithMany().HasForeignKey(i => i.UserId); 62 this.HasRequired(i => i.Order).WithMany( ).HasForeignKey(i => i.OrderId);61 this.HasRequired(i => i.Order).WithMany(o => o.Invoices).HasForeignKey(i => i.OrderId); 63 62 } 64 63 } … … 66 65 private class InvoiceLineConfiguration : EntityTypeConfiguration<InvoiceLine> { 67 66 internal InvoiceLineConfiguration() { 68 this.HasRequired(il => il.Invoice).WithMany( ).HasForeignKey(il => il.InvoiceId);67 this.HasRequired(il => il.Invoice).WithMany(i => i.InvoiceLines).HasForeignKey(il => il.InvoiceId).WillCascadeOnDelete(true); 69 68 this.HasRequired(il => il.Product).WithMany().HasForeignKey(il => il.ProductId); 70 69 } … … 74 73 internal UsageRecordConfiguration() { 75 74 this.HasRequired(ur => ur.User).WithMany().HasForeignKey(ur => ur.UserId); 76 } 77 } 78 79 private class UsageRecordLineConfiguration : EntityTypeConfiguration<UsageRecordLine> { 80 internal UsageRecordLineConfiguration() { 81 this.HasRequired(url => url.UsageRecord).WithMany().HasForeignKey(url => url.UsageRecordId); 75 this.HasRequired(ur => ur.Product).WithMany().HasForeignKey(ur => ur.ProductId); 82 76 } 83 77 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs
r9576 r9579 81 81 public virtual User User { get; set; } 82 82 public virtual Order Order { get; set; } 83 public virtual IList<InvoiceLine> InvoiceLines { get; set; } 83 84 } 84 85 … … 97 98 public long UsageRecordId { get; set; } 98 99 public long UserId { get; set; } 100 public long ProductId { get; set; } 101 public DateTime Begin { get; set; } 102 public DateTime End { get; set; } 103 public int ServiceIdentifier { get; set; } 104 public int ResourceIdentifier { get; set; } 99 105 100 106 public virtual User User { get; set; } 101 public virtual IList<UsageRecordLine> UsageRecordLines { get; set; } 102 } 103 104 public class UsageRecordLine { 105 public long UsageRecordLineId { get; set; } 106 public long UsageRecordId { get; set; } 107 public DateTime Begin { get; set; } 108 public DateTime End { get; set; } 109 110 public virtual UsageRecord UsageRecord { get; set; } 107 public virtual Product Product { get; set; } 111 108 } 112 109 }
Note: See TracChangeset
for help on using the changeset viewer.