★有ibatisnet开发经验的请进★

hs1983 2008-07-16 01:46:04
以前开发一直用ADO.NET模型,现在有个WEB项目要使用ibatisnet开发.自己在网上找了相关的资料看了下,感觉对ibatisnet还是不太了解.ADO.NET架构中经常使用的DataSet,DataTable,DataRow在ibatisnet是如何实现的?要实现用户登录和GridView分页该如何解决???请高手谈谈!!谢谢!!
...全文
79 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
mail_ricklee 2008-07-16
  • 打赏
  • 举报
回复
参考
http://www.cnblogs.com/mail-ricklee/archive/2008/03/06/1093260.html
里面的经过修改的IBatisNet

可以直接采用
QueryForDataSet/DataTable
QueryForOracleDataSet/DataTable

的方式,至于传入什么参数,这些都不用修改,用IBatisNet原始的就可以了.
sfssmiss 2008-07-16
  • 打赏
  • 举报
回复
http://www.cnblogs.com/anderslly/archive/2007/08/19/ibatisinactionch021.html


网上有的是
chinaicm 2008-07-16
  • 打赏
  • 举报
回复
下面是一个实体的Mapping例子.
基本上Select返回的就是IList类型的集合,DataSet具体在Ibatis里还没用到过.


<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Service.BO" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
<typeAlias alias="CardInfo" type="Service.BO.CardInfo, Service" />//找到实体
</alias>
<resultMaps>
<resultMap id="CardInfoResult" class="CardInfo"> //数据库和实体映射
<result property="CardId" column="CardId" />
<result property="CardPassword" column="CardPassword"/>
<result property="CardType" column="CardType" />
<result property="CardPrice" column="CardPrice" />
</resultMap>
</resultMaps>
<statements> //SQL语句
<select id="SelectCard" parameterClass="string" resultMap="CardInfoResult">
select CardId, CardPassword, CardType,CardPrice
from CardInfo
<dynamic prepend="WHERE">
<isParameterPresent>
CardId = #value#
</isParameterPresent>
</dynamic>
</select>
<select id="SelectAllCard" resultMap="CardInfoResult">
select CardId, CardPassword, CardType,CardPrice
from CardInfo
</select>
<select id="SelectCardCount" parameterClass="Hashtable" resultMap="CardInfoResult">
select CardId, CardPassword, CardType,CardPrice
from CardInfo
where CardId = #CardId# and CardPassword = #CardPassword#
</select>
<insert id="InsertCard" parameterClass="CardInfo" resultMap="CardInfoResult">
insert into CardInfo(CardId, CardPassword, CardType,CardPrice)
values (#CardId#, #CardPassword#, #CardType#,#CardPrice#)
</insert>

<update id="UpdateCard" parameterClass="CardInfo" resultMap="CardInfoResult">
update CardInfo set
CardType = #CardType#
where CardId = #CardId# and CardPassword = #CardPassword#
</update>
</statements>
</sqlMap>
hs1983 2008-07-16
  • 打赏
  • 举报
回复
还有相关介绍吗?
sfssmiss 2008-07-16
  • 打赏
  • 举报
回复
1.
/// <summary>
/// 根据条件执行数据邦定
/// </summary>
private void DataBind_PurchaseByState(int state, int recondcount)
{
if (recondcount == 0)
{
this.AspNetPager_Purchase.CurrentPageIndex = 1;
}
int count = recondcount;
int pageIndex = this.AspNetPager_Purchase.CurrentPageIndex;
int pageSize = this.AspNetPager_Purchase.PageSize;

this.GridView_Purchase.DataSource = ServiceLocator.PurchaseService.GetPurchaseCollectionByState(state, pageIndex, pageSize, ref count);
this.GridView_Purchase.DataBind();
this.AspNetPager_Purchase.RecordCount = count;

}
2.service层
IList<Purchase> GetPurchaseCollectionByState(int State,int pageIndex, int pageSize, ref int count);
3.model层
放实体
4.dataaccess
IList<Purchase> SearchPurchases(string state, string name, int pageIndex, int pageSize, ref int count);
5.common层
放数据连接的东西
6.在Maps里 放语句
<select id="SelectPurchaseByState" parameterClass="int" resultMap="PurchaseResult">
SELECT * FROM 表名
<dynamic prepend="WHERE">
<isParameterPresent>
State = #State#
</isParameterPresent>
</dynamic>
</select>
hs1983 2008-07-16
  • 打赏
  • 举报
回复
请教高手
kbryant 2008-07-16
  • 打赏
  • 举报
回复
友情up

61,823

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧