Exemplo n.º 1
0
        public virtual QueryModel CreateNewQueryModel(LambdaExpression selector)
        {
            QueryModel newQueryModel = this._queryModel.Clone();

            ComplexObjectModel complexObjectModel = this._queryModel.ResultModel as ComplexObjectModel;

            if (complexObjectModel != null)
            {
                complexObjectModel.SetupFilters(this._queryModel.IgnoreFilters);
            }

            ScopeParameterDictionary scopeParameters = this._queryModel.ScopeParameters.Clone(selector.Parameters[0], this._queryModel.ResultModel);
            IObjectModel             newResultModel  = SelectorResolver.Resolve(selector, scopeParameters, this._queryModel.ScopeTables);

            newQueryModel.ResultModel = newResultModel;

            return(newQueryModel);
        }
Exemplo n.º 2
0
        public virtual MappingData GenerateMappingData()
        {
            MappingData data = new MappingData();

            ComplexObjectModel complexObjectModel = this._queryModel.ResultModel as ComplexObjectModel;

            if (complexObjectModel != null)
            {
                complexObjectModel.SetupCollection(this._queryModel);
                complexObjectModel.SetupFilters(this._queryModel.IgnoreFilters);
            }

            DbSqlQueryExpression sqlQuery = this.CreateSqlQuery();

            var objectActivatorCreator = this._queryModel.ResultModel.GenarateObjectActivatorCreator(sqlQuery);

            objectActivatorCreator.IsRoot = true;

            data.SqlQuery = sqlQuery;
            data.ObjectActivatorCreator = objectActivatorCreator;

            return(data);
        }