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

Where() public method

public Where ( string token ) : Sql
token string
return Sql
        public Sql Where(string token, params object[] args)
        {
            token = this.ProcessToken(token);
            return this.Append(new Sql("WHERE (" + token + ")", args));
        }

Usage Example

Beispiel #1
0
        public async Task<IEnumerable<dynamic>> GetAsync(string resource, int userId, object[] resourceIds)
        {
            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 entity \"FlagView\" was denied to the user with Login ID {LoginId}. Resource: {Resource}, ResourceIds {ResourceIds}.", this.LoginId, resource, resourceIds);
                    throw new UnauthorizedException("Access is denied.");
                }
            }

            var sql = new Sql("SELECT * FROM config.flag_view");
            sql.Where("resource=@0", resource);
            sql.And("user_id=@0", userId);
            sql.Append("AND");
            sql.In("resource_id IN (@0)", resourceIds);

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