NHibernate的问题

Aleda 2008-11-21 10:03:54
type is not a ValueTypeType
参数名: type
行 39: sessions = cfg.BuildSessionFactory();

[ArgumentException: type is not a ValueTypeType
参数名: type]
NHibernate.Id.TableGenerator.Configure(IType type, IDictionary parms, Dialect dialect) +772
NHibernate.Id.TableHiLoGenerator.Configure(IType type, IDictionary parms, Dialect dialect) +25
NHibernate.Id.IdentifierGeneratorFactory.Create(String strategy, IType type, IDictionary parms, Dialect dialect) +289

[MappingException: could not instantiate id generator for strategy 'native']
NHibernate.Id.IdentifierGeneratorFactory.Create(String strategy, IType type, IDictionary parms, Dialect dialect) +366
NHibernate.Mapping.SimpleValue.CreateIdentifierGenerator(Dialect dialect) +34
NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings) +805
NHibernate.Cfg.Configuration.BuildSessionFactory() +65
Common.SessionFactory.BuildSessionFactory(String AssemblyName) in E:\working\ouxin\Common\SessionFactory.cs:39
Common.SessionFactory.OpenSession(String AssemblyName) in E:\working\ouxin\Common\SessionFactory.cs:26
Common.EntityControl.GetEntity(String table, String idFieldName, String id) in E:\working\ouxin\Common\EntityControl.cs:95
DAL.UserTableDAL.GetByUserName(String userName) in E:\working\ouxin\DAL\UserTableDAL.cs:44
BLL.UserTableBLL.GetByUserName(String userName) in E:\working\ouxin\BLL\UserTableBLL.cs:57
Ouxin.Default.btnLogin_Command(Object sender, EventArgs e) in e:\working\ouxin\web\Default.aspx.cs:31
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


这个是什么问题,在网上没找到相关的资料
...全文
102 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wazdoyang 2008-11-21
  • 打赏
  • 举报
回复
那你映射文件 貼出來 有嗎
Aleda 2008-11-21
  • 打赏
  • 举报
回复
顶上去
Aleda 2008-11-21
  • 打赏
  • 举报
回复
不是
wazdoyang 2008-11-21
  • 打赏
  • 举报
回复
你的主键 ID 是自动增长列吗?
孤独侠客123 2008-11-21
  • 打赏
  • 举报
回复
你还是得看看你的id的类型...是不是int ,navtive的id策略,说明你的id由数据库生成,所以你在数据库的表里,把他设置成自增

象这样

<id name="LanguageID" column="LanguageID" unsaved-value="0" type="System.Int32">
<generator class="native"/>
</id>


NeptuneGrass 2008-11-21
  • 打赏
  • 举报
回复
看看这个:
http://www.netcsharp.cn/topictag-49.aspx

PS:觉得有用的话,楼主赏个分吧
wazdoyang 2008-11-21
  • 打赏
  • 举报
回复

[MappingException: could not instantiate id generator for strategy 'native']

这句的问题吧 你研究研究
Aleda 2008-11-21
  • 打赏
  • 举报
回复
映射文件没有问题,拿到其他项目测试正常

62,269

社区成员

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

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

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

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