Пример #1
0
        public object CreateInstance(IDataReader reader)
        {
            var entity = this._entityActivator.CreateInstance(reader);

            //导航属性
            this._fitter.Fill(entity, null, reader);

            IQueryDataReader queryDataReader = (IQueryDataReader)reader;

            queryDataReader.AllowReadNextRecord = true;

            while (queryDataReader.Read())
            {
                if (!_entityRowComparer.IsEntityRow(entity, reader))
                {
                    queryDataReader.AllowReadNextRecord = false;
                    break;
                }

                this._fitter.Fill(entity, null, reader);
            }

            return(entity);
        }
Пример #2
0
        public async ObjectResultTask CreateInstance(IDataReader reader, bool @async)
        {
            var entity = await this._entityActivator.CreateInstance(reader, @async);

            //导航属性
            await this._fitter.Fill(entity, null, reader, @async);

            IQueryDataReader queryDataReader = (IQueryDataReader)reader;

            queryDataReader.AllowReadNextRecord = true;

            while (await queryDataReader.Read(true))
            {
                if (!_entityRowComparer.IsEntityRow(entity, reader))
                {
                    queryDataReader.AllowReadNextRecord = false;
                    break;
                }

                await this._fitter.Fill(entity, null, reader, @async);
            }

            return(entity);
        }