Frapid.Mapper.Sql.Append C# (CSharp) Method

Append() public method

public Append ( Sql sql ) : Sql
sql Sql
return Sql
        public Sql Append(Sql sql)
        {
            this._parameters.AddRange(sql._parameters);
            this._builder.Append(sql._builder);

            return this;
        }

Same methods

Sql::Append ( string token ) : Sql

Usage Example

Ejemplo n.º 1
0
        public async Task<IEnumerable<dynamic>> GetWhereAsync(long pageNumber, List<Filter> filters)
        {
            if (string.IsNullOrWhiteSpace(this.Database))
            {
                return null;
            }

            if (!this.SkipValidation)
            {
                if (!this.Validated)
                {
                    await this.ValidateAsync(AccessTypeEnum.Read, this.LoginId, this.Database, false).ConfigureAwait(false);
                }
                if (!this.HasAccess)
                {
                    Log.Information("Access to Page #{Page} of the filtered entity \"Filter\" was denied to the user with Login ID {LoginId}. Filters: {Filters}.", pageNumber, this.LoginId, filters);
                    throw new UnauthorizedException("Access is denied.");
                }
            }

            long offset = (pageNumber - 1) * 50;
            var sql = new Sql("SELECT * FROM config.filters WHERE 1 = 1");

            FilterManager.AddFilters(ref sql, new Filter(), filters);

            sql.OrderBy("filter_id");

            if (pageNumber > 0)
            {
                sql.Append(FrapidDbServer.AddOffset(this.Database, "@0"), offset);
                sql.Append(FrapidDbServer.AddLimit(this.Database, "@0"), 50);
            }

            return await Factory.GetAsync<dynamic>(this.Database, sql).ConfigureAwait(false);
        }
All Usage Examples Of Frapid.Mapper.Sql::Append