コード例 #1
0
        public static T MapToObject <T>(DbDataReader reader) where T : new()
        {
            var obj = new T();

            KandaDbDataMapper.MapToObject(reader, obj);

            return(obj);
        }
コード例 #2
0
        public static ICollection <T> MapToCollection <T>(DbDataReader reader) where T : new()
        {
            var collection = new Collection <T>();

            while (reader.Read())
            {
                var item = KandaDbDataMapper.MapToObject <T>(reader);

                collection.Add(item);
            }

            return(collection);
        }
コード例 #3
0
        public static IEnumerable <T> MapToEnumerable <T>(DataTable table) where T : new()
        {
            var reader = default(DbDataReader);

            try
            {
                reader = new DataTableReader(table);

                return(KandaDbDataMapper.MapToEnumerable <T>(reader));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
コード例 #4
0
 public static void MapToParameters(KandaDbDataReader reader, object obj)
 {
     KandaDbDataMapper.MapToParameters(reader.InnerCommand, obj);
 }
コード例 #5
0
 public static IEnumerable <T> MapToEnumerable <T>(DbDataReader reader) where T : new()
 {
     return(KandaDbDataMapper.MapToCollection <T>(reader));
 }