views:

35

answers:

1

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

+2  A: 

Nhibernate says that you have no mappings for MVCms.Models.Page. Try checking configuration and export all generated mappings into files.

Sly
Thanx, i had another class in that assembly that was not supposed to be included in the automappings. Everything working prrrrrrfect now.
Dusty Roberts