nhibernate not taking mappings from assembly
- by cvista
Hi
I'm using fnh and castle nhib facility.
I followed the advice from mike hadlow here: http://mikehadlow.blogspot.com/2009/01/integrating-fluent-nhibernate-and.html
here is my FluentNHibernateConfigurationBuilder:
public Configuration GetConfiguration(IConfiguration facilityConfiguration)
{
var defaultConfigurationBuilder = new DefaultConfigurationBuilder();
var configuration = defaultConfigurationBuilder.GetConfiguration(facilityConfiguration);
configuration.AddMappingsFromAssembly(typeof(User).Assembly);
return configuration;
}
i know the facility is picking it up as i can break inside that method and it steps through.
however, when it's done, non of the mappings are created and i get the following error when i try to save an entity:
No persister for: IsItGd.Model.Entities.User
here is my user class:
//simple model of web user
public class User
{
public virtual int Id { get; set; }
public virtual string FullName { get; set; }
}
and here is the mapping:
public class UserMap : ClassMap<User>
{
public UserMap() {
Id(x=>x.Id);
Map(x=>x.FullName);
}
}
i really can't see what the problem is. the strange thing is - is that if i use automapping it picks everything up - but i don't want to use automapping as i can't do certain things in that scenario.
any clues?
w://