-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: using the sql configuration file in app.config doesn't work
PostPosted: Sun Jun 28, 2009 9:37 am 
Newbie

Joined: Sun Jun 28, 2009 9:33 am
Posts: 2
Hi,
cutting and pasting the configuration file to app.config doesn't work.

This is my current app config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="System.Configuration.NameValueSectionHandler, System,
Version=1.0.3300.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>

<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<!-- This is the System.Data.dll provider for SQL Server -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">
Data Source=192,168.5.101;Initial Catalog=HelloNHibernate;User Id =nh;Password=123456!
</property>
<property name="adonet.batch_size">10</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="use_outer_join">true</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
</configuration>

This throws an exception on the xmlns="urn:nhibernate-configuration-2.2"
if I remove this, it will throw an exception on the next line (unrecognized element...)
the c# code that activate the exception is:
static ISession OpenSession()
{
---> Configuration c = new Configuration();
c.AddAssembly(Assembly.GetCallingAssembly());
ISessionFactory f = c.BuildSessionFactory();
return f.OpenSession();
}

What should I do ?
what should be the factory name (if not test ?)

Thanks,
Dani


Top
 Profile  
 
 Post subject: Re: using the sql configuration file in app.config doesn't work
PostPosted: Mon Jun 29, 2009 2:42 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Which version do you use ? Try this section definition instead:

<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: using the sql configuration file in app.config doesn't work
PostPosted: Mon Jun 29, 2009 2:56 am 
Newbie

Joined: Sun Jun 28, 2009 9:33 am
Posts: 2
Thanks, You where right !

(now I need to fix the connection string... and it might even work...)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.