public virtual QueryCommand QueryJoinData(DataContext context, DataMapping mapping, ISelector selector, List <IJoinModel> models, QueryExpression query, OrderExpression order, bool distinct, Region region) { CreateSqlState state = new CreateSqlState(context); CommandData commandData = _factory.CreateSelectJoinTableCommand(selector, models, query, order, distinct, region, state); DbCommand command = commandData.CreateCommand(this, state); QueryState queryState = new QueryState(); foreach (IJoinModel model in models) { if (model.NoDataSetEntityNull) { queryState.SetNoDataSetNull(model.AliasTableName); } } queryState.SetSelector(selector); QueryCommand queryCommand = new QueryCommand() { Command = command, InnerPage = commandData.InnerPage, State = queryState }; return(queryCommand); }