Beispiel #1
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 #2
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());
        }
Beispiel #3
0
        /// <summary>
        /// Appends a table-valued parameter from the current values, e.g. <c>@TP0</c>, to the projection buffer.
        /// </summary>
        /// <param name="projection">The current projection.</param>
        /// <returns>A new attribute containing the appended buffer.</returns>
        public static IProjectionAttribute TvpName(this IProjection projection)
        {
            if (projection.Data == null)
            {
                throw new ProjectionException($"No value information found for {projection.Metadata.Identity}.");
            }
            else if (!projection.Any())
            {
                throw new ProjectionException($"No attributes found for {projection.Metadata.Identity}.");
            }

            RelationHeader header   = new RelationHeader(projection.Metadata.Identity.Schema, projection.Header.Select(a => a.Metadata.Relation).ToList());
            Relation       relation = new Relation(projection.Data.Input, header);

            string paramName   = projection.Context.Lookup.Custom("TP", projection.Identity, metadata: projection.Metadata.Identity, value: projection.Data.Input);
            string dialectName = projection.Context.Domain.Dialect.Parameter(paramName);

            return(projection.Attr().Append(dialectName).Append(new TableValuedParameter(paramName, relation)));
        }
 public bool IsInitialized(IProjection[] projections)
 {
     if (IsVersioningTableExists())
     {
         return projections.Any(IsVersionExist);
     }
     return false;
 }
 public bool IsInitialized(IProjection[] projections)
 {
     return projections.Any(IsVersionExist);
 }