I have an Abstract class:
[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
}
and i have a class:
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; }
}
When i run the following code i get an error:
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 });
}
The Error Accurs here:
public static void Save(object obj)
{
Session.SaveOrUpdate(obj); // Error: No persister for: MVCms.Models.Page
}
I am using Fluent nHibernate and i have automappings on.
Can anyone tell me wtf i am doing wrong here? Any help would be appreciated