I was not able to reproduce the error you received, but I did get that
sample application working.  Here is my story:


Wow, the project file is for Visual Studio 2003.  I even have that
version of Visual Studio installed.  And the copyright date in the
source was last updated in 2006 so this sample is likely due for an
update.

Like you, I updated the connection string in appconfig.xml to specify
the correct database server.  I also specified a username and password
in my connection string since my SQL database isn't setup for Windows
authentication.

I put the DLLs from Castle ActiveRecord 2.1.2 where the project file
expected them to be (which was quite awkward - FYI the relative path
appears to be relative to the bin directory).

I received this error when I built:

Metadata file 'c:\...\build\net-1.1\debug\Iesi.Collections.dll' could
not be opened -- 'Version 2.0 is not a compatible version.'

I'm guessing Castle ActiveRecord 2.1.2 doesn't support Visual Studio
2003 / .NET 1.1, so I upgraded the project to Visual Studio 2005.

I then received this error after building in Visual Studio 2005:

Error   1       The type or namespace name 'Expression' does not exist in the
namespace 'NHibernate' (are you missing an assembly
reference?)     C:\...\InitializingAndConfiguring\Models\User.cs        20      
19      BlogSample-vs2003

In User.cs, I replaced "using NHibernate.Expression;" with "using
NHibernate.Criterion;".

I compiled again and received this error:

Error   1       The name 'CountAll' does not exist in the current
context C:\...\InitializingAndConfiguring\Models\User.cs        63      11      
BlogSample-vs2003

My guess is that method was removed from ActiveRecordBase at some
point.  I changed it to call the Count method instead of CountAll.

Compiling succeeded.

Run attempt #1:

--
System.TypeInitializationException: The type initializer for
'Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder'
threw an exception. ---> System.IO.FileNotFoundException: Could not
load file or assembly 'Castle.Components.Validator, Version=1.1.1.0,
Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its
dependencies. The system cannot find the file specified.
File name: 'Castle.Components.Validator, Version=1.1.1.0,
Culture=neutral, PublicKeyToken=407dd0808d44fbdc'
   at Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder..cctor()

=== Pre-bind state information ===
LOG: User = ...\Michael
LOG: DisplayName = Castle.Components.Validator, Version=1.1.1.0,
Culture=neutral, PublicKeyToken=407dd0808d44fbdc
 (Fully-specified)
LOG: Appbase = file:///C:/.../InitializingAndConfiguring/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Castle.ActiveRecord, Version=2.1.2.0,
Culture=neutral, PublicKeyToken=407dd0808d44fbdc.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Castle.Components.Validator,
Version=1.1.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Castle.Components.Validator.DLL.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Castle.Components.Validator/Castle.Components.Validator.DLL.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Castle.Components.Validator.EXE.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Castle.Components.Validator/Castle.Components.Validator.EXE.

   --- End of inner exception stack trace ---
   at Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder..ctor()
   at Castle.ActiveRecord.ActiveRecordStarter.BuildModels(ISessionFactoryHolder
holder, IConfigurationSource source, IEnumerable`1 types, Boolean
ignoreProblematicTypes)
   at 
Castle.ActiveRecord.ActiveRecordStarter.RegisterTypes(ISessionFactoryHolder
holder, IConfigurationSource source, IEnumerable`1 types, Boolean
ignoreProblematicTypes)
   at Castle.ActiveRecord.ActiveRecordStarter.Initialize(IConfigurationSource
source, Type[] types)
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 44
--

I added a reference to Castle.Components.Validator.dll.

Run attempt #2:
--
Castle.ActiveRecord.Framework.ActiveRecordException: Error adding
information from class BlogSample.Blog to NHibernate. Check the inner
exception for more information ---> NHibernate.MappingException: Could
not compile the mapping document: (string) --->
System.InvalidOperationException: Could not find the dialect in the
configuration
   at NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
   at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
   --- End of inner exception stack trace ---
   at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
   at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
   at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
   at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument
document)
   at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader,
String name)
   at NHibernate.Cfg.Configuration.AddXml(String xml, String name)
   at NHibernate.Cfg.Configuration.AddXml(String xml)
   at NHibernate.Cfg.Configuration.AddXmlString(String xml)
   at Castle.ActiveRecord.ActiveRecordStarter.AddXmlString(Configuration
config, String xml, ActiveRecordModel model)
   --- End of inner exception stack trace ---
   at Castle.ActiveRecord.ActiveRecordStarter.AddXmlString(Configuration
config, String xml, ActiveRecordModel model)
   at 
Castle.ActiveRecord.ActiveRecordStarter.AddXmlToNHibernateCfg(ISessionFactoryHolder
holder, ActiveRecordModelCollection models)
   at 
Castle.ActiveRecord.ActiveRecordStarter.RegisterTypes(ISessionFactoryHolder
holder, IConfigurationSource source, IEnumerable`1 types, Boolean
ignoreProblematicTypes)
   at Castle.ActiveRecord.ActiveRecordStarter.Initialize(IConfigurationSource
source, Type[] types)
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 44
--

I changed:

key="hibernate.dialect"

in appconfig.xml to:

key="dialect"

Run attempt #3:

I received the "Schema - Do you want to let ActiveRecord create the
database tables?" dialog.

I selected Yes.

I received the following exception:

--
Castle.ActiveRecord.Framework.ActiveRecordException: Could not create
the schema ---> NHibernate.HibernateException: The user must provide
an ADO.NET connection - NHibernate is not creating it. --->
System.InvalidOperationException: The user must provide an ADO.NET
connection - NHibernate is not creating it.
   at NHibernate.Connection.UserSuppliedConnectionProvider.GetConnection()
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   --- End of inner exception stack trace ---
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script,
Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean script,
Boolean export)
   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   --- End of inner exception stack trace ---
   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 59
--

I changed:

key="hibernate.connection.connection_string"

in appconfig.xml to:

key="connection.connection_string"

Run attempt #4:

--
A first chance exception of type
'Castle.ActiveRecord.Framework.ActiveRecordException' occurred in
Castle.ActiveRecord.dll
Castle.ActiveRecord.Framework.ActiveRecordException: Could not create
the schema ---> NHibernate.HibernateException: Cannot open database
requested in login 'test'. Login fails.
Login failed for user 'sa'. ---> System.Data.SqlClient.SqlException:
Cannot open database requested in login 'test'. Login fails.
Login failed for user 'sa'.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
   at 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64
timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
host, String newPassword, Boolean redirectedUserInstance,
SqlConnection owningObject, SqlConnectionString connectionOptions,
Int64 timerStart)
   at 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
   at 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
   at 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   --- End of inner exception stack trace ---
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script,
Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean script,
Boolean export)
   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   --- End of inner exception stack trace ---
   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   at BlogSample.App.Main() in C:\...\App.cs:line 59
A first chance exception of type
'Castle.ActiveRecord.Framework.ActiveRecordException' occurred in
BlogSample.exe
System.Transactions Critical: 0 : <TraceRecord
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord";
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
exception</Description><AppDomain>BlogSample.vshost.exe</AppDomain><Exception><ExceptionType>Castle.ActiveRecord.Framework.ActiveRecordException,
Castle.ActiveRecord, Version=2.1.2.0, Culture=neutral,
PublicKeyToken=407dd0808d44fbdc</ExceptionType><Message>Could not
create the schema</Message><StackTrace>   at
Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   at BlogSample.App.Main() in C:\...\App.cs:line 64
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>Castle.ActiveRecord.Framework.ActiveRecordException:
Could not create the schema ---&amp;gt; NHibernate.HibernateException:
Cannot open database requested in login 'test'. Login fails.
Login failed for user 'sa'. ---&amp;gt;
System.Data.SqlClient.SqlException: Cannot open database requested in
login 'test'. Login fails.
Login failed for user 'sa'.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
   at 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64
timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
host, String newPassword, Boolean redirectedUserInstance,
SqlConnection owningObject, SqlConnectionString connectionOptions,
Int64 timerStart)
   at 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
   at 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
   at 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   --- End of inner exception stack trace ---
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script,
Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean script,
Boolean export)
   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   --- End of inner exception stack trace ---
   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()
   at BlogSample.App.Main() in C:\...\App.cs:line 64
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>NHibernate.HibernateException,
NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4</ExceptionType><Message>Cannot open
database requested in login 'test'. Login fails.
Login failed for user 'sa'.</Message><StackTrace>   at
NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1 scriptAction,
Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script,
Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean script,
Boolean export)
   at 
Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()</StackTrace><ExceptionString>NHibernate.HibernateException:
Cannot open database requested in login 'test'. Login fails.
Login failed for user 'sa'. ---&amp;gt;
System.Data.SqlClient.SqlException: Cannot open database requested in
login 'test'. Login fails.
Login failed for user 'sa'.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
   at 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64
timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
host, String newPassword, Boolean redirectedUserInstance,
SqlConnection owningObject, SqlConnectionString connectionOptions,
Int64 timerStart)
   at 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
   at 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
   at 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   --- End of inner exception stack trace ---
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script,
Boolean export, Boolean justDrop)
   at NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean script,
Boolean export)
   at 
Castle.ActiveRecord.ActiveRecordStarter.CreateSchema()</ExceptionString><InnerException><ExceptionType>System.Data.SqlClient.SqlException,
System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Cannot open
database requested in login 'test'. Login fails.
Login failed for user 'sa'.</Message><StackTrace>   at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
   at 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64
timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
host, String newPassword, Boolean redirectedUserInstance,
SqlConnection owningObject, SqlConnectionString connectionOptions,
Int64 timerStart)
   at 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
   at 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
   at 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean
justDrop)</StackTrace><ExceptionString>System.Data.SqlClient.SqlException:
Cannot open database requested in login 'test'. Login fails.
Login failed for user 'sa'.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
   at 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64
timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
host, String newPassword, Boolean redirectedUserInstance,
SqlConnection owningObject, SqlConnectionString connectionOptions,
Int64 timerStart)
   at 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
   at 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
   at 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
   at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean
justDrop)</ExceptionString><DataItems><Data><Key>HelpLink.ProdName</Key><Value>Microsoft
SQL 
Server</Value></Data><Data><Key>HelpLink.EvtSrc</Key><Value>MSSQLServer</Value></Data><Data><Key>HelpLink.EvtID</Key><Value>4060</Value></Data><Data><Key>HelpLink.BaseHelpUrl</Key><Value>http://go.microsoft.com/fwlink</Value></Data><Data><Key>HelpLink.LinkId</Key><Value>20476</Value></Data></DataItems></InnerException></InnerException></Exception></TraceRecord>
--

I went into SQL Server and created a database named "test".

Run attempt #5:

--
System.Transactions Critical: 0 : <TraceRecord
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord";
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
exception</Description><AppDomain>BlogSample.vshost.exe</AppDomain><Exception><ExceptionType>NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException,
NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4</ExceptionType><Message>The
ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the
session-factory configuration section with one of the available
NHibernate.ByteCode providers.
Example:
&amp;lt;property
name='proxyfactory.factory_class'&amp;gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu&amp;lt;/property&amp;gt;
Example:
&amp;lt;property
name='proxyfactory.factory_class'&amp;gt;NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle&amp;lt;/property&amp;gt;</Message><StackTrace>
  at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory()
   at NHibernate.Cfg.Configuration.ValidateEntities()
   at NHibernate.Cfg.Configuration.Validate()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory(Type
type)
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession(Type
type)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)
   at Castle.ActiveRecord.ActiveRecordBase.Count(Type targetType)
   at BlogSample.User.GetUsersCount() in
C:\...\InitializingAndConfiguring\Models\User.cs:line 63
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 70
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException:
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the
session-factory configuration section with one of the available
NHibernate.ByteCode providers.
Example:
&amp;lt;property
name='proxyfactory.factory_class'&amp;gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu&amp;lt;/property&amp;gt;
Example:
&amp;lt;property
name='proxyfactory.factory_class'&amp;gt;NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle&amp;lt;/property&amp;gt;
   at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory()
   at NHibernate.Cfg.Configuration.ValidateEntities()
   at NHibernate.Cfg.Configuration.Validate()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory(Type
type)
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession(Type
type)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)
   at Castle.ActiveRecord.ActiveRecordBase.Count(Type targetType)
   at BlogSample.User.GetUsersCount() in
C:\...\InitializingAndConfiguring\Models\User.cs:line 63
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 70
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>
--

I updated appconfig.xml to contain:

        <add
                key="proxyfactory.factory_class"
                value="NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle" />

Run attempt #6:

--
System.Transactions Critical: 0 : <TraceRecord
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord";
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
exception</Description><AppDomain>BlogSample.vshost.exe</AppDomain><Exception><ExceptionType>NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException,
NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4</ExceptionType><Message>Unable to load
type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle' during configuration of proxy factory
class.
Possible causes are:
- The NHibernate.Bytecode provider assembly was not deployed.
- The typeName used to initialize the 'proxyfactory.factory_class'
property of the session-factory section is not well formed.

Solution:
Confirm that your deployment folder contains one of the following assemblies:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll</Message><StackTrace>   at
NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String
typeName)
   at NHibernate.Cfg.Configuration.ConfigureProxyFactoryFactory()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory(Type
type)
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession(Type
type)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)
   at Castle.ActiveRecord.ActiveRecordBase.Count(Type targetType)
   at BlogSample.User.GetUsersCount() in
C:\...\InitializingAndConfiguring\Models\User.cs:line 63
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 70
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException:
Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle' during configuration of proxy factory
class.
Possible causes are:
- The NHibernate.Bytecode provider assembly was not deployed.
- The typeName used to initialize the 'proxyfactory.factory_class'
property of the session-factory section is not well formed.

Solution:
Confirm that your deployment folder contains one of the following assemblies:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll ---&amp;gt;
System.IO.FileNotFoundException: Could not load file or assembly
'NHibernate.ByteCode.Castle' or one of its dependencies. The system
cannot find the file specified.
File name: 'NHibernate.ByteCode.Castle'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark&amp;amp; stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark&amp;amp; stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp;amp;
stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark&amp;amp; stackMark, Boolean
forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError)
   at NHibernate.Util.ReflectHelper.ClassForName(String name)
   at NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String
typeName)

=== Pre-bind state information ===
LOG: User = ...\Michael
LOG: DisplayName = NHibernate.ByteCode.Castle
 (Partial)
LOG: Appbase = file:///C:/.../InitializingAndConfiguring/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

   --- End of inner exception stack trace ---
   at NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String
typeName)
   at NHibernate.Cfg.Configuration.ConfigureProxyFactoryFactory()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory(Type
type)
   at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession(Type
type)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)
   at Castle.ActiveRecord.ActiveRecordBase.Count(Type targetType)
   at BlogSample.User.GetUsersCount() in
C:\...\InitializingAndConfiguring\Models\User.cs:line 63
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 70
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>System.IO.FileNotFoundException,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Could not load
file or assembly 'NHibernate.ByteCode.Castle' or one of its
dependencies. The system cannot find the file
specified.</Message><StackTrace>   at
System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark&amp;amp; stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark&amp;amp; stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp;amp;
stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark&amp;amp; stackMark, Boolean
forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError)
   at NHibernate.Util.ReflectHelper.ClassForName(String name)
   at NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String
typeName)</StackTrace><ExceptionString>System.IO.FileNotFoundException:
Could not load file or assembly 'NHibernate.ByteCode.Castle' or one of
its dependencies. The system cannot find the file specified.
File name: 'NHibernate.ByteCode.Castle'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark&amp;amp; stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark&amp;amp; stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp;amp;
stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark&amp;amp; stackMark, Boolean
forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError)
   at NHibernate.Util.ReflectHelper.ClassForName(String name)
   at NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String
typeName)

=== Pre-bind state information ===
LOG: User = ...\Michael
LOG: DisplayName = NHibernate.ByteCode.Castle
 (Partial)
LOG: Appbase = file:///C:/.../InitializingAndConfiguring/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
</ExceptionString></InnerException></Exception></TraceRecord>
--

I copied NHibernate.ByteCode.Castle.dll to the bin folder.

Run attempt #7:

--
System.Transactions Critical: 0 : <TraceRecord
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord";
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
exception</Description><AppDomain>BlogSample.vshost.exe</AppDomain><Exception><ExceptionType>Castle.ActiveRecord.Framework.ActiveRecordException,
Castle.ActiveRecord, Version=2.1.2.0, Culture=neutral,
PublicKeyToken=407dd0808d44fbdc</ExceptionType><Message>Could not
perform ExecuteQuery for User</Message><StackTrace>   at
Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)
   at Castle.ActiveRecord.ActiveRecordBase.Count(Type targetType)
   at BlogSample.User.GetUsersCount() in
C:\...\InitializingAndConfiguring\Models\User.cs:line 63
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 70
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>Castle.ActiveRecord.Framework.ActiveRecordException:
Could not perform ExecuteQuery for User ---&amp;gt;
System.IO.FileNotFoundException: Could not load file or assembly
'Antlr3.Runtime, Version=3.1.0.39271, Culture=neutral,
PublicKeyToken=3a9cab8f8d22bfb7' or one of its dependencies. The
system cannot find the file specified.
File name: 'Antlr3.Runtime, Version=3.1.0.39271, Culture=neutral,
PublicKeyToken=3a9cab8f8d22bfb7'
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2
replacements, Boolean shallow, String collectionRole)
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile(IDictionary`2
replacements, Boolean shallow)
   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String
collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
ISessionFactoryImplementor factory)
   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean
shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor
factory)
   at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String
queryString, Boolean shallow, IDictionary`2 enabledFilters)
   at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String
query, Boolean shallow)
   at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String queryString)
   at Castle.ActiveRecord.Queries.HqlBasedQuery.CreateQuery(ISession session)
   at Castle.ActiveRecord.Queries.CountQuery.InternalExecute(ISession session)
   at 
Castle.ActiveRecord.ActiveRecordBaseQuery.Castle.ActiveRecord.IActiveRecordQuery.Execute(ISession
session)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)

=== Pre-bind state information ===
LOG: User = ...\Michael
LOG: DisplayName = Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7
 (Fully-specified)
LOG: Appbase = file:///C:/.../InitializingAndConfiguring/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime.DLL.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime/Antlr3.Runtime.DLL.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime.EXE.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime/Antlr3.Runtime.EXE.

   --- End of inner exception stack trace ---
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)
   at Castle.ActiveRecord.ActiveRecordBase.Count(Type targetType)
   at BlogSample.User.GetUsersCount() in
C:\...\InitializingAndConfiguring\Models\User.cs:line 63
   at BlogSample.App.Main() in C:\...\InitializingAndConfiguring\App.cs:line 70
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>System.IO.FileNotFoundException,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Could not load
file or assembly 'Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7' or one of its
dependencies. The system cannot find the file
specified.</Message><StackTrace>   at
NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2
replacements, Boolean shallow, String collectionRole)
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile(IDictionary`2
replacements, Boolean shallow)
   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String
collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
ISessionFactoryImplementor factory)
   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean
shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor
factory)
   at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String
queryString, Boolean shallow, IDictionary`2 enabledFilters)
   at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String
query, Boolean shallow)
   at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String queryString)
   at Castle.ActiveRecord.Queries.HqlBasedQuery.CreateQuery(ISession session)
   at Castle.ActiveRecord.Queries.CountQuery.InternalExecute(ISession session)
   at 
Castle.ActiveRecord.ActiveRecordBaseQuery.Castle.ActiveRecord.IActiveRecordQuery.Execute(ISession
session)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)</StackTrace><ExceptionString>System.IO.FileNotFoundException:
Could not load file or assembly 'Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7' or one of its
dependencies. The system cannot find the file specified.
File name: 'Antlr3.Runtime, Version=3.1.0.39271, Culture=neutral,
PublicKeyToken=3a9cab8f8d22bfb7'
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2
replacements, Boolean shallow, String collectionRole)
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile(IDictionary`2
replacements, Boolean shallow)
   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String
collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
ISessionFactoryImplementor factory)
   at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean
shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor
factory)
   at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String
queryString, Boolean shallow, IDictionary`2 enabledFilters)
   at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String
query, Boolean shallow)
   at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String queryString)
   at Castle.ActiveRecord.Queries.HqlBasedQuery.CreateQuery(ISession session)
   at Castle.ActiveRecord.Queries.CountQuery.InternalExecute(ISession session)
   at 
Castle.ActiveRecord.ActiveRecordBaseQuery.Castle.ActiveRecord.IActiveRecordQuery.Execute(ISession
session)
   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)

=== Pre-bind state information ===
LOG: User = ...\Michael
LOG: DisplayName = Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7
 (Fully-specified)
LOG: Appbase = file:///C:/.../InitializingAndConfiguring/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime.DLL.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime/Antlr3.Runtime.DLL.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime.EXE.
LOG: Attempting download of new URL
file:///C:/.../InitializingAndConfiguring/bin/Antlr3.Runtime/Antlr3.Runtime.EXE.
</ExceptionString></InnerException></Exception></TraceRecord>
--

I copied Antlr3.Runtime.dll to the bin directory.

Run attempt #8:

I received the login dialog box.

Login: admin
Password: 123

The app works!

-Michael Maddox
http://www.AgilityForORMs.com/Home/Products/AfoCastleActiveRecordModelCodeGenerator/


On Mon, Aug 30, 2010 at 5:23 AM, LeCong <[email protected]> wrote:
> Hi,
>
> I'm download "Getting started with ActiveRecord" sample from link:
> http://www.castleproject.org/activerecord/gettingstarted/index.html
>
> I'm create database
> changing connection in appconfig.xml file
> run it
>
> throws an exception:
> System.TypeInitializationException was unhandled
> Message="The type initializer for
> 'Castle.ActiveRecord.Framework.Internal.EventListener.EventListenerContributor'
> threw an exception."
> Source="Castle.ActiveRecord"
> TypeName="Castle.ActiveRecord.Framework.Internal.EventListener.EventListenerContributor"
> StackTrace:
> at
> Castle.ActiveRecord.Framework.Internal.EventListener.EventListenerContributor..ctor()
> at
> Castle.ActiveRecord.ActiveRecordStarter.RegisterEventListeners(IEnumerable`1
> types)
> at
> Castle.ActiveRecord.ActiveRecordStarter.Initialize(IConfigurationSource
> source, Type[] types)
> at BlogSample.App.Main() in D:\lecong's Data\PASONA_MyFile\docs\Castle
> Active Record\InitializingAndConfiguring\App.cs:line 42
> at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
> at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
> at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
> at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
> at System.Threading.ThreadHelper.ThreadStart()
>
> Can you help me?
> P/S: please send mail to me.
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Users" 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/castle-project-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.

Reply via email to