| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | 
							- using System;
 
- using InABox.Core;
 
- namespace Comal.Classes
 
- {
 
-     
 
-     public interface ICustomerProduct
 
-     {
 
-         CustomerLink Customer { get; set; }
 
-         ProductLink Product { get; set; }
 
-         ProductCharge Charge { get; set; }
 
-     }
 
-     
 
-     [UserTracking(typeof(Product))]
 
-     public class CustomerProduct : Entity, IPersistent, IRemotable, 
 
-         ICustomerProduct,
 
-         IManyToMany<Customer, Product>, 
 
-         IManyToMany<Product, Customer>, 
 
-         ILicense<ProductManagementLicense>, 
 
-         IExportable,
 
-         IImportable
 
-     {
 
-         [EntityRelationship(DeleteAction.Cascade)]
 
-         [EditorSequence(1)]
 
-         public CustomerLink Customer { get; set; }
 
-         [EntityRelationship(DeleteAction.Cascade)]
 
-         [EditorSequence(2)]
 
-         public ProductLink Product { get; set; }
 
-         [ProductChargeEditor]
 
-         [EditorSequence(3)]
 
-         public ProductCharge Charge { get; set; }
 
-         protected override void Init()
 
-         {
 
-             base.Init();
 
-             Customer = new CustomerLink();
 
-             Product = new ProductLink(() => this);
 
-             Charge = new ProductCharge();
 
-         }
 
-     }
 
-     
 
-     public class CustomerProductUnionGenerator : AutoEntityUnionGenerator<ICustomerProduct>
 
-     {
 
-         protected override void Configure()
 
-         {
 
-             AddTable<CustomerProduct>();
 
-             AddTable<Product>()
 
-                 .AddConstant(x => x.Customer.ID, Guid.Empty)
 
-                 .AddConstant(x=>x.Product.ID, new Column<Product>(x=>x.ID));
 
-         }
 
-         public override bool Distinct => false;
 
-         public override Column<ICustomerProduct>[] IDColumns => new Column<ICustomerProduct>[]
 
-         {
 
-             new Column<ICustomerProduct>(x => x.Customer.ID),
 
-             new Column<ICustomerProduct>(x => x.Product.ID)
 
-         };
 
-     }
 
-     [AutoEntity(typeof(CustomerProductUnionGenerator))]
 
-     public class CustomerProductSummary : Entity, IRemotable, IPersistent, ICustomerProduct, ILicense<CoreLicense>
 
-     {
 
-         public CustomerLink Customer { get; set; }
 
-         public ProductLink Product { get; set; }
 
-         public ProductCharge Charge { get; set; }
 
-         protected override void Init()
 
-         {
 
-             base.Init();
 
-             Customer = new CustomerLink();
 
-             Product = new ProductLink(() => this);
 
-             Charge = new ProductCharge();
 
-         }
 
-     }
 
-     
 
- }
 
 
  |