Question

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://

Was it helpful?

Solution 2

this has been fixed - it was a bug in fnh :(

OTHER TIPS

Are your mapping files located in the same assembly as you domain classes? Otherwise you might want to use UserMap instead of User when specifying the assembly to look in:

configuration.AddMappingsFromAssembly(typeof(UserMap).Assembly);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top