EmployeeDigitalForm.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlTypes;
  4. using System.Linq;
  5. using System.Linq.Expressions;
  6. using InABox.Core;
  7. namespace Comal.Classes
  8. {
  9. public interface IEmployeeDigitalForm
  10. {
  11. EmployeeLink Employee { get; set; }
  12. DigitalFormLink Form { get; set; }
  13. }
  14. public class EmployeeDigitalFormCrossGenerator : AutoEntityCrossGenerator<IEmployeeDigitalForm,EmployeeRole,RoleForm>
  15. {
  16. public override Expression<Func<EmployeeRole, Guid>> LeftProperty => x => x.EmployeeLink.ID;
  17. public override Expression<Func<IEmployeeDigitalForm, Guid>> LeftMapping => x => x.Employee.ID;
  18. public override Expression<Func<EmployeeRole, Guid>> LeftLink => x => x.RoleLink.ID;
  19. public override Expression<Func<RoleForm, Guid>> RightProperty => x => x.Form.ID;
  20. public override Expression<Func<IEmployeeDigitalForm, Guid>> RightMapping => x => x.Form.ID;
  21. public override Expression<Func<RoleForm, Guid>> RightLink => x => x.Role.ID;
  22. public override bool Distinct => true;
  23. }
  24. [UserTracking(typeof(Employee))]
  25. [AutoEntity(typeof(EmployeeDigitalFormCrossGenerator))]
  26. public class EmployeeDigitalForm : Entity, IRemotable, IPersistent, IEmployeeDigitalForm,
  27. ILicense<CoreLicense>
  28. {
  29. [EntityRelationship(DeleteAction.Cascade)]
  30. public EmployeeLink Employee { get; set; }
  31. [EntityRelationship(DeleteAction.Cascade)]
  32. public DigitalFormLink Form { get; set; }
  33. protected override void Init()
  34. {
  35. base.Init();
  36. Employee = new EmployeeLink();
  37. Form = new DigitalFormLink();
  38. }
  39. }
  40. }