I copied example from Fluent NHibernate GitHub documentation for automapping and it doesn't work in my ASP.NET MVC 4 app.
public class Product
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual decimal Price { get; set; }
}
public class Shelf
{
public virtual int Id { get; set; }
public virtual IList<Product> Products { get; set; }
public Shelf()
{
Products = new List<Product>();
}
}
Are models. When I add
.Mappings(m => m.AutoMappings
.Add(AutoMap.AssemblyOf<Product>()))
to my configuration I get error No parameterless constructor defined for this object.
. Without that, my session works fine and also with mapping defined by me one by one, everything works. Just automapping doesn't work. What's the problem?