12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 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<TInterface, TLeft, TRight> : IAutoEntityCrossGenerator
- {
- public abstract Expression<Func<TLeft, Guid>> LeftProperty { get; }
- public abstract Expression<Func<TInterface, Guid>> LeftMapping { get; }
- public abstract Expression<Func<TLeft, Guid>> LeftLink { get; }
-
- public abstract Expression<Func<TRight, Guid>> RightProperty { get; }
- public abstract Expression<Func<TInterface, Guid>> RightMapping { get; }
- public abstract Expression<Func<TRight, Guid>> 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<TInterface>[] IDColumns { get; }
- IColumn[] IAutoEntityGenerator.IDColumns => IDColumns;
- }
- }
|