| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | using System;using System.Collections.Generic;using System.Data.SqlTypes;using System.Linq;using System.Linq.Expressions;using InABox.Core;namespace Comal.Classes{    public interface IEmployeeActivity    {        EmployeeLink Employee { get; set; }                ActivityLink Activity { get; set; }            }        public class EmployeeActivityCrossGenerator : AutoEntityCrossGenerator<IEmployeeActivity,EmployeeRole,RoleActivity>    {        public override Expression<Func<EmployeeRole, Guid>> LeftProperty => x => x.EmployeeLink.ID;        public override Expression<Func<IEmployeeActivity, Guid>> LeftMapping => x => x.Employee.ID;        public override Expression<Func<EmployeeRole, Guid>> LeftLink => x => x.RoleLink.ID;                public override Expression<Func<RoleActivity, Guid>> RightProperty => x => x.Activity.ID;        public override Expression<Func<IEmployeeActivity, Guid>> RightMapping => x => x.Activity.ID;        public override Expression<Func<RoleActivity, Guid>> RightLink => x => x.Role.ID;        public override bool Distinct => true;    }        [UserTracking(typeof(Employee))]    [AutoEntity(typeof(EmployeeActivityCrossGenerator))]    public class EmployeeActivity : Entity, IRemotable, IPersistent, IEmployeeActivity,        ILicense<CoreLicense>    {        [EntityRelationship(DeleteAction.Cascade)]        public EmployeeLink Employee { get; set; }        [EntityRelationship(DeleteAction.Cascade)]        public ActivityLink Activity { get; set; }        protected override void Init()        {            base.Init();            Employee = new EmployeeLink();            Activity = new ActivityLink();        }    }}
 |