1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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; }
- }
-
- 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; }
- }
-
- }
|