我有这堂课:
public class Person
{
public virtual long ID { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual boolean IsValid { get; set; }
}
和人员数据映射:
public class PersonMap : ClassMap<Person>
{
public PersonMap()
{
Id(x => x.ID);
Map(x => x.FirstName).Not.Nullable().Length(100);
Map(x => x.LastName).Not.Nullable().Length(100);
Map(x => x.IsValid).Not.Nullable();
}
}
这是表模式:
CREATE TABLE [dbo].[Person](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](100) NOT NULL,
[LastName] [nvarchar](100) NOT NULL,
[IsValid ] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
当我使用 Fluent NHibernate 在数据库中插入一个新Person
的但我们遇到了这个问题:
error dehydrating property value for `NameSpaceA.IsValid`
和内部异常:
_innerException = {"Invalid index 2 for this SqlParameterCollection with Count=2."}