예제 #1
0
        /// <summary>
        /// <see cref="IDataReader"/> 로부터 <see cref="XdsResponseItem"/>을 빌드한다.
        /// </summary>
        /// <param name="dr"></param>
        /// <returns>Instance of <see cref="XdsResponseItem"/></returns>
        public static XdsResponseItem Create(IDataReader dr)
        {
            dr.ShouldNotBeNull("dr");

            if (IsDebugEnabled)
            {
                log.Debug("Create new XdsResponseItem from IDataReader");
            }

            var responseItem = new XdsResponseItem();

            for (var i = 0; i < dr.FieldCount; i++)
            {
                responseItem.Fields.AddField(dr.GetName(i), dr.GetDataTypeName(i), MsgConsts.INVALID_ID);
            }

            do
            {
                while (dr.Read())
                {
                    responseItem.Records.AddRecord(dr);
                }
            } while(dr.NextResult());

            return(responseItem);
        }
예제 #2
0
        /// <summary>
        /// <see cref="DataView"/>로부터 <see cref="XdsResponseItem"/>을 빌드한다.
        /// </summary>
        /// <param name="dv">원본 <see cref="DataView"/></param>
        /// <returns>Instance of <see cref="XdsResponseItem"/></returns>
        public static XdsResponseItem Create(DataView dv)
        {
            dv.ShouldNotBeNull("dv");

            var responseItem = new XdsResponseItem();

            for (var i = 0; i < dv.Table.Columns.Count; i++)
            {
                responseItem.Fields.AddField(dv.Table.Columns[i]);
            }

            for (var i = 0; i < dv.Count; i++)
            {
                responseItem.Records.AddRecord(dv[i].Row);
            }

            return(responseItem);
        }
예제 #3
0
 /// <summary>
 /// Add new <see cref="XdsResponseItem"/>
 /// </summary>
 /// <param name="responseItem">Instance of <see cref="XdsResponseItem"/> to add.</param>
 /// <returns>index of collection, if <paramref name="responseItem"/> is null, return -1</returns>
 public int AddResponseItem(XdsResponseItem responseItem)
 {
     return(Responses.AddResponseItem(responseItem));
 }