ibatis.net:第六天,QueryForList

xml

1     <statement id="FindOrdersByCustomer" parameterClass="string" resultClass="Order">
2       SELECT Id, Customer FROM [Orders] WHERE Customer = #value#
3     </statement>

代码

1         public static void FindOrdersByCustomer()
2         {
3             var mapper = Mapper.Instance();
4 
5             var orders = mapper.QueryForList<Order>("FindOrdersByCustomer", "段光伟", 3, 3);
6             Console.WriteLine(orders.Count);
7         }

备注

QueryForList 主要面对的场景是:列表查询、分页查询,同样提供两种返回结果的模式:创建和填充。

框架地址:http://happy.codeplex.com