我也是NHibernate和MVC的新手。
我有一个包含
等属性的模型类public class RegisterViewModel
{
[Required]
[Display(Name="Full Name")]
public string Name { get; set; }
[Required]
[Display(Name = "Email Id")]
public string EailID { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 1)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
我为此模型创建了xml映射文件,如下所示。
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
auto-import="true" assembly="EventMgnt" namespace="EventMgnt.Models">
<class name="EventMgnt.Models.RegisterViewModel" table="tblUser" dynamic-update="true" >
<cache usage="read-write"/>
<id name="Id" column="Id" type="int">
<generator class="native" />
</id>
<property name="Name" />
<property name="EmailID" />
<property name="Password" />
<property name="ConfirmPassword" />
</class>
</hibernate-mapping>
我收到Could not compile the mapping document
错误。现在我几乎没有问题,
任何帮助都会感激不尽。
答案 0 :(得分:2)