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;

Thanks,
--Randy Burden
http://randyburden.com

On Friday, August 15, 2008 8:56:33 AM UTC-5, Fernando Zago wrote:
>
> Hello guys.... 
>
> I'm changing my framework to a newer version of NHibernate.
> but, when a changed the version i have to change all xml mappings files
> from xmlns="urn:nhibernate-mapping-2.0" to 
> xmlns="urn:nhibernate-mapping-2.2".
>
> and now, i have one other problem, NHibernate needs to add a attribute 
> auto-import="false",
> because auto-import defaults its "true", and its giving me an error >
>
> *The following types may not be used as proxies:
> ContentManager.Noticias.Noticia: method get_Autor should be virtual*
> So, if i change "Noticia" mapping adding auto-import="false", it works, 
> but, i have on framework 350 mappings file.
>
> So, in nhibernate configuration, have an option to change defaults from 
> auto-import attributes ?
> btw, i want to is there an default-lazy too ?
>
> Thanks, cya
>
> ---
> A vida me ensinou a nunca desistir,
> nem ganhar, nem perder mas procurar evoluir.
> Podem me tirar tudo que tenho!
> Só não podem me tirar as coisas boas que eu já fiz pra quem eu amo!
> E eu sou feliz e canto e o universo é uma canção eu vou que vou!
>  

On Friday, August 15, 2008 8:56:33 AM UTC-5, Fernando Zago wrote:
>
> Hello guys.... 
>
> I'm changing my framework to a newer version of NHibernate.
> but, when a changed the version i have to change all xml mappings files
> from xmlns="urn:nhibernate-mapping-2.0" to 
> xmlns="urn:nhibernate-mapping-2.2".
>
> and now, i have one other problem, NHibernate needs to add a attribute 
> auto-import="false",
> because auto-import defaults its "true", and its giving me an error >
>
> *The following types may not be used as proxies:
> ContentManager.Noticias.Noticia: method get_Autor should be virtual*
> So, if i change "Noticia" mapping adding auto-import="false", it works, 
> but, i have on framework 350 mappings file.
>
> So, in nhibernate configuration, have an option to change defaults from 
> auto-import attributes ?
> btw, i want to is there an default-lazy too ?
>
> Thanks, cya
>
> ---
> A vida me ensinou a nunca desistir,
> nem ganhar, nem perder mas procurar evoluir.
> Podem me tirar tudo que tenho!
> Só não podem me tirar as coisas boas que eu já fiz pra quem eu amo!
> E eu sou feliz e canto e o universo é uma canção eu vou que vou!
>  

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/dIVddgAAWvwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to