Two classes with the same name but different namspaces

15 views
Skip to first unread message

Armin Landscheidt

unread,
Jan 30, 2010, 1:09:14 PM1/30/10
to nhusers
Hallo,

I have two classes with the same name but different namespaces. If I
want two add both to the NHiberante configuration the configuration
throws an exception because of duplicated mappings.

Is this a bug? If not I think this would be a nice feature.

Fabio Maulo

unread,
Jan 30, 2010, 1:15:00 PM1/30/10
to nhu...@googlegroups.com
autoimport="false"
To allow you to easy write an HQL NH is registering the even name of the class.
For example:
from Something

With autoimport="false" you must use the full name of the class in your query
from YourCompany.YourProduct.Something

2010/1/30 Armin Landscheidt <sai...@googlemail.com>

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.




--
Fabio Maulo

Armin Landscheidt

unread,
Jan 30, 2010, 1:20:11 PM1/30/10
to nhusers
Ah ok thanks for the answer. Now I understand this behaviour which was
very strange when I got the Exception first time.

On 30 Jan., 19:15, Fabio Maulo <fabioma...@gmail.com> wrote:
> autoimport="false"
> To allow you to easy write an HQL NH is registering the even name of the
> class.
> For example:
> from Something
>
> With autoimport="false" you must use the full name of the class in your
> query
> from YourCompany.YourProduct.Something
>

> 2010/1/30 Armin Landscheidt <saij...@googlemail.com>


>
>
>
> > Hallo,
>
> > I have two classes with the same name but different namespaces. If I
> > want two add both to the NHiberante configuration the configuration
> > throws an exception because of duplicated mappings.
>
> > Is this a bug? If not I think this would be a nice feature.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to nhu...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>

Randy Burden

unread,
May 15, 2012, 7:07:44 PM5/15/12
to nhu...@googlegroups.com
NHibernate now has the BeforeBindMapping event which gives you access to the object representation of the HBM XML files at runtime. You can use this event to set all mappings to auto-import="false" like so:

var configuration = new NHibernate.Cfg.Configuration();

configuration.BeforeBindMapping += (sender, args) => args.Mapping.autoimport = false;

Reply all
Reply to author
Forward
0 new messages