protected override DataTable FetchRows(TkDbContext context, DataSet dataSet, IParamBuilder builder, int topCount) { SqlSelector selector = new SqlSelector(context, dataSet); using (selector) { IParamBuilder addBuilder = CreateAdditionCondition(context, fScheme); builder = ParamBuilder.CreateParamBuilder(builder, addBuilder); string whereSql; if (builder == null) { whereSql = string.Empty; } else { whereSql = "WHERE " + builder.Sql; } TableSchemeData schemeData = TableSchemeData.Create(context, fScheme); var result = context.ContextConfig.GetListSql(schemeData.SelectFields, GetTableName(context), schemeData.KeyFieldArray, whereSql, OrderBy, 0, topCount); ISimpleAdapter adapter = selector; adapter.SetSql(result.ListSql, builder); context.ContextConfig.SetListData(result, adapter, dataSet, 0, TopCount, EASYSEARCH_TABLE_NAME); return(dataSet.Tables[EASYSEARCH_TABLE_NAME]); } }
protected internal BaseSqlEasySearch(string sql, string idField, string nameField, TkDbContext context) : base(new SqlProxyScheme(DbUtil.CreateSqlTableScheme(sql, TABLE_NAME, idField, context), idField, nameField), StringUtil.GetNickName(idField), StringUtil.GetNickName(nameField), false) { fSql = sql; TableSchemeData schemeData = TableSchemeData.Create(context, ProxyScheme); fSelectFields = schemeData.SelectFields; }