Hi All!
Before send this post, i've searched smilar problems on hibernate.org and another sites, but i can't find the solution. So there is my problem;
i've downloaded codesmith nhibernatemaster template from google code. and added it my project.then i create an app.config file, that is following code here.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=localhost;database=goingnuts;uid=sa;pwd=lol</property>
<mapping assembly="MailList"/>
<!-- NHibernate 2.1 -->
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
</session-factory>
</hibernate-configuration>
</configuration>
Error Line;
Code:
_sessionFactory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();
Stack Trace
Code:
" at NHibernate.Cfg.Environment.get_Properties()\r\n at NHibernate.Cfg.Configuration.Reset()\r\n at NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory)\r\n at NHibernate.Cfg.Configuration..ctor()\r\n at MailList.Data.Base.NHibernateSessionManager..ctor() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\Base\\NHibernateSessionManager.cs:line 68\r\n at MailList.Data.Base.NHibernateSessionManager.get_Instance() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\Base\\NHibernateSessionManager.cs:line 40\r\n at MailList.Data.Base.ManagerBase`2..ctor() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\Base\\ManagerBase.cs:line 54\r\n at MailList.Data.ManagerObjects.ListManager..ctor() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\ManagerObjects\\ListManager.Generated.cs:line 20\r\n at MailList.Data.ManagerObjects.ManagerFactory.GetListManager() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\ManagerObjects\\ManagerFactory.cs:line 34\r\n at MailList.Demo.Program.Main(String[] args) in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Demo\\Program.cs:line 16\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
Inner Exception
Code:
{"An error occurred creating the configuration section handler for hibernate-configuration: An exception occurred parsing configuration :The element 'session-factory' in namespace 'urn:nhibernate-configuration-2.2' has invalid child element 'property' in namespace 'urn:nhibernate-configuration-2.2'. List of possible elements expected: 'mapping, class-cache, collection-cache, event, listener' in namespace 'urn:nhibernate-configuration-2.2'. (C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Demo\\bin\\Debug\\MailList.Demo.vshost.exe.config line 6)"}
Thanks.
Greetins From Turkiye