private static IDbSelectable CreateNewSelectableForWrappingSelect( IDbSelect dbSelect, IDbSelectable selectable, DbReference dbRef, Expression m, IDbObjectFactory dbFactory, UniqueNameGenerator nameGenerator) { if (dbRef == null) { return(selectable); } var oCol = selectable as IDbColumn; if (oCol != null) { return(dbFactory.BuildColumn(dbRef, oCol.GetAliasOrName(), oCol.ValType)); } var oRefCol = selectable as IDbRefColumn; if (oRefCol != null) { return(dbFactory.BuildRefColumn(dbRef, oRefCol.Alias, oRefCol)); } if (selectable is IDbFunc oDbFunc) { if (string.IsNullOrEmpty(oDbFunc.Alias)) { oDbFunc.Alias = nameGenerator.GenerateAlias(dbSelect, oDbFunc.Name, true); } return(dbFactory.BuildColumn(dbRef, oDbFunc.Alias, oDbFunc.ReturnType)); } return(dbFactory.BuildColumn(dbRef, selectable.Alias, typeof(string))); }
private static IDbSelectable CreateNewSelectableForWrappingSelect( IDbSelectable selectable, DbReference dbRef, IDbObjectFactory dbFactory) { if (dbRef == null) { return(selectable); } var oCol = selectable as IDbColumn; if (oCol != null) { return(dbFactory.BuildColumn(dbRef, oCol.GetAliasOrName(), oCol.ValType)); } var oRefCol = selectable as IDbRefColumn; if (oRefCol != null) { return(dbFactory.BuildRefColumn(dbRef, oRefCol.Alias, oRefCol)); } return(dbFactory.BuildColumn(dbRef, selectable.Alias, typeof(string))); }
public SqlOrderColumn(IDbSelectable selectable, DbOrderDirection direction = DbOrderDirection.Asc) { DbSelectable = selectable; Direction = direction; }
public IDbOrderByColumn BuildOrderByColumn(IDbSelectable selectable, DbOrderDirection direction = DbOrderDirection.Asc) { return(new SqlOrderColumn(selectable, direction)); }
public static string GetAliasOrName(this IDbSelectable selectable) { var column = selectable as IDbColumn; return(column != null ? column.Alias ?? column.Name : selectable.Alias); }
public static string GetNameOrAlias(this IDbSelectable selectable) { var column = selectable as IDbColumn; return(column?.Name ?? selectable?.Alias); }