How run Castle Active REcord Example
I can't run properly example from castle site under VS2010 +mssql2008 (I try it under ms win xp - mssql2005 +ms c# 2010 express too)
...
// We are using XmlConfigurationSource: XmlConfigurationSource source = new XmlConfigurationSource("appconfig.xml");
ActiveRecordStarter.Initialize( source, typeof(Blog), typeof(Post), typeof(User) ); ...
at Initialize in app.cs module an exception : {"The type initializer for 'NHibernate.LoggerProvider' threw an exception."}
Inner exception:
{"Unrecognized configuration section config. (C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\bin\BlogSample.vshost.exe.Config line 3)"}
What wrong? xml config :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="activerecord"
type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord" />
</configSections>
<activerecord isWeb="false" pluralizeTableNames="true">
<config>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.connection.connection_string" value="Data Source=|DataDirectory|\Gecko1#1.sdf;Password=ghbdtn185" />
</config>
</activerecord>
</configuration>
Befor this I was try
< ?xml version="1.0" encoding="utf-8" ?>
< activerecord isWeb="false" pluralizeTableNames="true">
< config>
< add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
< add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
< add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConn开发者_开发知识库ectionProvider" />
< add key="hibernate.connection.connection_string" value="Data Source=|DataDirectory|\Gecko1#1.sdf;Password=ghbdtn185" />
< /config>
< /activerecord>
But I get:
{"Configuration system failed to initialize"}
That sample code is very old (originally VS2003). I recommend using one of these projects as reference, although that list is also somewhat old by now (but not as old as the sample code)
精彩评论