jagregory/fluent-nhibernate — Issue #105: Automapper tries to map private class
Author: doerig
Created: 2011-10-18 09:35:27+00:00
State: open

After Upgrading from FNH 1.2 to 1.3 my project threw some runtime exceptions. It turned out that fnh 1.3 tries to map a private nested class. Is this intended behaviour or a bug?

I fixed the problem within the AutomappingConfiguration (checking for IsPublic).

```C#
public class AutomappingConfiguration : DefaultAutomappingConfiguration
{
public override bool ShouldMap(Type type)
{
return type.IsPublic && type.IsSubclassOf(typeof(ModelBase));
}
}
```

Simplified class-setup:

```C#
public class MappedClass : ModelBase
{
}

public class NotMappedClass
{
private class WhyDoesThisClassGetsMapped : MappedClass
{
}
}

```