EmployeeRequiredQualification.cs 1.9 KB

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