using System; using System.Linq; using System.Linq.Expressions; namespace InABox.Core { public interface IAutoEntityCrossGenerator : IAutoEntityGenerator { String LeftEntity(); String LeftProperty(); String LeftMapping(); String LeftLink(); String RightEntity(); String RightProperty(); String RightMapping(); String RightLink(); } public abstract class AutoEntityCrossGenerator : IAutoEntityCrossGenerator { public abstract Expression> LeftProperty { get; } public abstract Expression> LeftMapping { get; } public abstract Expression> LeftLink { get; } public abstract Expression> RightProperty { get; } public abstract Expression> RightMapping { get; } public abstract Expression> RightLink { get; } public string LeftEntity() => typeof(TLeft).EntityName().Split('.').Last(); string IAutoEntityCrossGenerator.LeftProperty() => CoreUtils.GetFullPropertyName(LeftProperty, "."); string IAutoEntityCrossGenerator.LeftMapping() => CoreUtils.GetFullPropertyName(LeftMapping, "."); string IAutoEntityCrossGenerator.LeftLink() => CoreUtils.GetFullPropertyName(LeftLink, "."); public string RightEntity() => typeof(TRight).EntityName().Split('.').Last(); string IAutoEntityCrossGenerator.RightProperty() => CoreUtils.GetFullPropertyName(RightProperty, "."); string IAutoEntityCrossGenerator.RightMapping() => CoreUtils.GetFullPropertyName(RightMapping, "."); string IAutoEntityCrossGenerator.RightLink() => CoreUtils.GetFullPropertyName(RightLink, "."); public abstract bool Distinct { get; } public Type Definition => typeof(TInterface); public abstract Column[] IDColumns { get; } IColumn[] IAutoEntityGenerator.IDColumns => IDColumns; } }