hibernate.cfg.xml should not be an embedded resource. It should be copied to your output directory - always or if newer, whichever you prefer. The mapping files must* to be marked as embedded resources. * There are other ways of reading the mapping files than using embedded resources, but usually only for advanced scenarios where embedding doesn't work.
HTH, James -- James Kovacs, B.Sc., M.Sc., MCSD, MCT Microsoft MVP - C# Architecture http://www.jameskovacs.com [EMAIL PROTECTED] 403-397-3177 (mobile) On Mon, Sep 29, 2008 at 5:05 PM, kindaian <[EMAIL PROTECTED]> wrote: > > DLL version: 2.0.0.4000 > > Environment: > > Visual Basic 2008 Express > .NET 3.5 > SQL Server 2008 Express > Project model: Windows Application > > Visual Basic was configured to accept the nhibernate configuration > sections into app.config (the information for that is outdated on the > book/online resources - will open issue if needed after this). > > Setup Application: > > 1. Added a class for the "application space", not an issue. > 2. Added the hibernate.cfg.xml > > Issue with the "embebed resource" (adding the build action as such > isn't enought for sorting the issue. It is required that you change > the "Copy to Output Directory" to "Always Copy" or at least to "Copy > if newer"). Docs shoud be updated reflecting this (or at least warning > - not sure but i believe that this option is new on the VS2008 > generation). > > 3. Then i proceeded by adding my mappings to the configuration and the > issue blowed the application: > > <mapping resource="EDP2008.Gabinete.hbm.xml" assembly="EDP2008" /> > > Produces the following error: > > Resource not found: EDP2008.Gabinete.hbm.xml > > 4. Workaround: > > First i removed the mapping from the configuration file. > Then, on the configuration innitialization i added the file > manually: > > Dim myConfig As New Configuration > myConfig.SetProperty("dialect", > "NHibernate.Dialect.MsSql2005Dialect") > > Dim basePath As String = > System.Windows.Forms.Application.StartupPath > > myConfig.AddXmlFile(basePath & "\EDP2008.Gabinete.hbm.xml") > > Dim myFactory As ISessionFactory = > myConfig.Configure.BuildSessionFactory > > Dim mySession As ISession = myFactory.OpenSession > > Note: It is not the ideal solution, but it works... > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
