首页 新闻 会员 周边 捐助

求助Nibernate双向级联的问题

0
悬赏园豆:10 [已关闭问题]

小弟最近在学Nibernate 遇到个问题是在费解,直接代码贴上

<bag cascade="all" inverse="true" name="SaleInfo" lazy="false">
<key column="saleNo" property-ref="SaleNo" not-null="true" />
<one-to-many class="DEV_JIZHANG.Models.SalesInfo, DEV_JIZHANG" />
</bag>
<many-to-one column="saleNo"
class="DEV_JIZHANG.Models.SalesUserInfo, DEV_JIZHANG" name="SaleUserInfo"
not-null="true" property-ref="SaleNo" />

以上是双向关联的配置

 

代码
SalesUserInfo userInfo = new SalesUserInfo();
userInfo.PiaoType
= txtPiaoType.Text.Trim();
userInfo.Remark
= txtRemark.Text.Trim();
userInfo.SalesPeople
= txtSaler.Text.Trim();
userInfo.Sex
= rblSex.Text.Trim();
userInfo.Uid
= int.Parse(PublicFunction.GetUserID(this.Page.Request));
userInfo.UserName
= txtUser.Text.Trim();
userInfo.UserPhone
= txtPhone.Text.Trim();
userInfo.SmallPiao
= txtSmallPiao.Text.Trim();
userInfo.SaleNo
= JIZHANGService.CreateInServiceBLL().WXNO("SS", userInfo.Uid);
userInfo.SalesDate
= DateTime.Now;
userInfo.SalesType
= "已销售";
IList
<SalesInfo> ss = new List<SalesInfo>();

foreach (var item in ReturnList())
{
item.Uid
= userInfo.Uid;
item.SaleNo
= userInfo.SaleNo;
item.SaleUserInfo
= userInfo;
item.SalesBackPrice
= 0;
item.SalesBackType
= "";

ss.Add(item);
}

userInfo.SaleInfo
= ss;

JIZHANGService.CreateSalesUserInfoBLL().SaveOrUpdateCopyEntity(userInfo)

最后报错 此 SqlParameterCollection 的 Count=9 的索引 9 无效

 

我的奶酪我做主的主页 我的奶酪我做主 | 初学一级 | 园豆:190
提问于:2010-03-30 15:38
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册