public SqlSelectColumn(QueryElementBasedMappedProperty prop, ICompositeKey columnKey) : this( prop.To, prop.MappedPropertyType, prop.PropertySegmentConstructors, columnKey, prop.MappingContext) { }
internal static IQueryTable GetSingleMappingContext(QueryElementBasedMappedProperty column) { var rowNumberTables = column.FromParams .GetEnumerable() .Where(c => !c.IsParameter) .Select(c => c.Column.PrimaryKey.Table) .Distinct() .ToList(); var mappingContext = column.MappingContext .LastOrDefault(x => rowNumberTables.Contains(x)) ?? column.MappingContext.FirstOrDefault(); return(mappingContext ?? throw new InvalidOperationException($"You must have at least one mapping context: {column.To}.")); }