Hi
I'm using the mapping attributes instead of the xml files, and I'm having a problem determining how to add the right attributes for two classes which share the same name, but in different namespaces in the same assembly.
For example:
Code:
namespace MyCompany.Domain.Area1
{
[HibernateMapping(AutoImport = false, Namespace = "MyCompany.Domain.Area1", Assembly = "MyCompany.Domain")]
[Class(1, Table = "DomainArea1", Name = "MyCompany.Domain.Area1.Widget, MyCompany.Domain")]
public class Widget
{
}
}
namespace MyCompany.Domain.Area2
{
[HibernateMapping(AutoImport = false, Namespace = "MyCompany.Domain.Area2", Assembly = "MyCompany.Domain")]
[Class(1, Table = "DomainArea2", Name = "MyCompany.Domain.Area2.Widget, MyCompany.Domain")]
public class Widget
{
}
}
And I'm referencing these in collections as follows:
Code:
namespace MyCompany.Domain
{
public class WidgetHolder
{
[Set(Lazy = true)]
[Key(1)]
[OneToMany(2, Class = "MyCompany.Domain.Area1.Widget, MyCompany.Domain")]
public ISet<Widget> Widgets
{
}
}
}
namespace MyCompany.Domain
{
public class DifferentWidgetHolder
{
[Set(Lazy = true)]
[Key(1)]
[OneToMany(2, Class = "MyCompany.Domain.Area2.Widget, MyCompany.Domain")]
public ISet<Widget> Widgets
{
}
}
}
But I get the "duplicate import" exception referring to my widgets, and suggesting I add auto-import = false to my mappings. As you can see, I've already got autoimport specified.
I've read the other thread on this issue and the auto-import attribute seemed to work for that person, so where am I going wrong?
Cheers
Lee