我有一个抽象类:
[Serializable]
public abstract class BaseModel
{
public virtual int Id { get; private set; }
public virtual DateTime? CreatedOn { get; set; }
public virtual string CreatedBy { get; set; }
public virtual DateTime? UpdatedOn { get; set; }
public virtual string UpdatedBy { get; set; }
public virtual Status Status { get; set; }
}
public enum Status
{
InActive = 0,
Active = 1
}
public class Page : BaseModel
{
public virtual string Name { get; set; }
public virtual string Route { get; set; }
public virtual string DisplayName { get; set; }
public virtual string Parent { get; set; }
}
for (int i = 0; i < 10; i++)
{
DataAccess.McContext.Save(new Models.Page() { Name = "Home" + i, Parent = "0", DisplayName = "Home", Route = "Home", Status = Models.Status.Active });
}
错误发生在:
public static void Save(object obj)
{
Session.SaveOrUpdate(obj); // Error: No persister for: MVCms.Models.Page
}
我用流利的nHibernate和我有自动映射。
有人能告诉我我做错了什么吗?任何帮助都将不胜感激