Beispiel #1
0
        /// <summary>
        /// Appends the current table alias, e.g. <c>T0</c>, to the attribute buffer.
        /// </summary>
        /// <param name="attribute">The current attribute.</param>
        /// <returns>A new attribute containing the appended buffer.</returns>
        public static IProjectionAttribute Ali(this IProjectionAttribute attribute)
        {
            ITableMetadata table = ProjectionHelper.GetPreferredTableMetadata(attribute);

            string alias = attribute.Context.Lookup.Table(attribute.Identity, table.Identity);

            return(attribute.Append(alias));
        }
Beispiel #2
0
        /// <summary>
        /// Appends the current table name, e.g. <c>"MyTable"</c>, to the attribute buffer.
        /// </summary>
        /// <param name="attribute">The current attribute.</param>
        /// <returns>A new attribute containing the appended buffer.</returns>
        public static IProjectionAttribute TblName(this IProjectionAttribute attribute)
        {
            ITableMetadata table = ProjectionHelper.GetPreferredTableMetadata(attribute);

            string qualifier = attribute.Context.Domain.Dialect.Qualifier;
            string tableName = string.Join(qualifier, table.TableName.Select(attribute.Context.Domain.Dialect.Identifier));

            return(attribute.Append(tableName));
        }
Beispiel #3
0
        /// <summary>
        /// Appends mappings between the current qualified columns and their properties, e.g. <c>T0."MyColumn" AS "Item.MyValue"</c>, to the projection buffer. Identical to calling <c>Cols().As().Props()</c>.
        /// </summary>
        /// <param name="projection">The current projection</param>
        /// <param name="tblAlias">The table alias to qualify each column name with.</param>
        /// <returns>A new projection containing the appended buffer.</returns>
        public static IProjection Star(this IProjection projection, string tblAlias = null)
        {
            if (!projection.Any())
            {
                throw ProjectionException.AttributesNotFound(projection.Metadata);
            }

            IProjectionMetadata metadata = ProjectionHelper.GetPreferredTableMetadata(projection.Metadata);

            return(projection.With(metadata).Cols(tblAlias).As().Props());
        }
Beispiel #4
0
        /// <summary>
        /// Appends mappings between the current qualified columns and their properties, e.g. <c>T0."MyColumn" AS "Item.MyValue"</c>, to the projection buffer. Identical to calling <c>Cols().As().Props()</c>.
        /// </summary>
        /// <param name="projection">The current projection</param>
        /// <returns>A new projection containing the appended buffer.</returns>
        public static IProjection Star(this IProjection projection)
        {
            if (!projection.Any())
            {
                throw ProjectionException.FromProjection(projection, "No attributes found.");
            }

            IProjectionMetadata metadata = ProjectionHelper.GetPreferredTableMetadata(projection).Identity.GetMetadata <IProjectionMetadata>();

            return(projection.With(metadata).Cols().As().Props());
        }