小弟最近在学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 无效