I have a class in my domain model root that looks like this:
namespace Domain
{
public class Foo { ... }
}
I also have another class with the same name in a different namespace:
namespace Domain.SubDomain
{
public class Foo { ... }
}
For my mappings, I have a Mapping
directory with a subdirectory called SubDomain
that contains mappings for the domain classes found in Domain.SubDomain
namespace. They are all in the same assembly.
However, when I try to load them with NHibernate, I keep getting a DuplicateMappingException
... even though both Foos having different namespaces. The code I am using to load my NHibernate configuration is this:
var cfg = new Configuration()
.Configure()
.AddAssembly("Domain");
How can I tell NHibernate to let me use two entities with the same name (but different namespaces)?