【发布时间】:2015-01-12 13:07:16
【问题描述】:
NHibernate 错误消息 此 SqlParameterCollection 的索引 4 无效,Count=4。
我的映射:
public KazangAccountClassMap()
{
Table("KazangAccount");
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Channel).Not.Nullable();
Map(x => x.UserName).Not.Nullable();
Map(x => x.Password).Not.Nullable();
HasMany<KazangMerchant>(x => x.KazangMerchants)
.KeyColumn("AccountId")
.Inverse();
}
控制器:
public ActionResult SaveChannelProperty(string NewProp, string ChannelName)
{
client.CreateKazangChannelAttribute(new KazangChannelAttr
{
KazangChannelId = ChannelObject.Id,
AttrName = NewProp,
AttrValue = NewProp,
AttrType = ""
});
}
【问题讨论】:
-
这个错误很容易找到,也很容易修复,但是请显示完整的异常堆栈跟踪和与该错误相关的映射。
标签: c# sql asp.net-mvc nhibernate