Unknown column 'user0_.Id' in 'field list'
Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: MySql.Data.MySqlClient.MySqlException: Unknown column 'user0_.Id'
in 'field list'
Source Error:
Line 31: public ActionResult Login(AuthLogin formlogin,string returnurl)
Line 32: {
Line 33: var MUser = Database.Session.Query<user>().FirstOrDefault(u =>
u.username == formlogin.Username);
Line 34: if(MUser==null)
Line 35: user.FakeHash()
错误在第33行
答案 0 :(得分:0)
如果没有你的NHibernate映射和一些关于底层MySQL表结构的片段,很难判断。
但正如例外所述,NHibernate创建了这样的查询,在其SELECT cluase ('field list')中生成了不存在的名称(SELECT user0_.Id
...)
可能的原因可能是:
id
列应为{的 User_ID
强> 如果这些提示还不够,请不要犹豫,并使用更多/映射详细信息扩展问题