I added this line and it seems to work:
cfg.AddAssembly(this.GetType().Assembly);

So now the configuration section is this:
Configuration cfg = new Configuration();
cfg.AddAssembly(this.GetType().Assembly);
cfg.Properties["hibernate.connection.provider"] =
"NHibernate.Connection.DriverConnectionProvider";
cfg.Properties["hibernate.dialect"] =
"NHibernate.Dialect.MsSqlCeDialect";
cfg.Properties["hibernate.connection.driver_class"] =
"NHibernate.Driver.SqlServerCeDriver";
cfg.Properties["hibernate.connection.connection_string"] = path;

cfg.AddXmlFile("Project.hbm.xml");
sessionFactory = cfg.BuildSessionFactory();

Thanks all.

On Dec 21, 12:56 pm, Fabio Maulo <[email protected]> wrote:
> A little bit more about NHibernate 
> configurationhttp://fabiomaulo.blogspot.com/2009/07/nhibernate-configuration-cache...
> <http://fabiomaulo.blogspot.com/2009/07/nhibernate-configuration-cache...>You
> can use that post to navigate the series.
>
>
>
>
>
>
>
>
>
> On Tue, Dec 21, 2010 at 5:59 AM, kor <[email protected]> wrote:
> > you must call AddResource, AddXmlFile is to add a phisical xml file.
>
> > anyway the suggest way to work with embedded mapping files is to use
> > AddAssembly (so you need a single call for every assembly which
> > contains the mapping files without warning of update the code if you
> > change same name/namespace inside the assembly)
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected] 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
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