Finally got an example running, it was terribly slow, but as I was running from a networked
drive thought that was it, moved the project locally and its slow as hell and in particular
it takes forever to perform
"Loading Symbols Castle.DynamicProxy.dll", as I can see what's
it's doing within the VisualStudio 2005 debugger.
I have attempted to remove this particular DLL as believed I only needed NHibernate.DLL
and the logging.dll if I was going to use the logging process?
Again I am trying the most basic of examples! Sorry if this is something basic and stupid
on my part, as typically these type of errors are.
VisualStudio2005 SP2
NHibernate.dll version 1.2.1.4000
Thanks!
Code:
Here is my XML Definition
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
namespace="NHibernateASPSample.Domain"
assembly="NHibernateASPSample.Domain">
<class name="DbUser" table="DbUser">
<id name="IdUser" column="IdUser" type="Int32">
<generator class="identity"/>
</id>
<property name="Login" column="Login" type="String"/>
<property name="Password" column="Password" type="String"/>
<property name="UserData" column="UserData" type="String"/>
</class>
</hibernate-mapping>
Here is my class
Code:
using System;
using System.Web;
namespace NHibernateASPSample.Domain
{
/// <summary>
/// Class that holds the data of the table DbUser
/// </summary>
public class DbUser
{
#region Members
private int _idUser;
private string _login;
private string _password;
private string _userData;
#endregion
/// <summary>
/// A standard-constructor is needed!
/// </summary>
public DbUser()
{
}
public int IdUser
{
get { return _idUser; }
set { _idUser = value; }
}
public string Login
{
get { return _login; }
set { _login = value; }
}
public string Password
{
get { return _password; }
set { _password = value; }
}
public string UserData
{
get { return _userData; }
set { _userData = value; }
}
}
}
Here is my web.config
Code:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System,Version=1.0.5000.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
</configSections>
<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<add key="hibernate.connection.connection_string" value="User ID=sa;Password=sa1267;Data Source=GENESIS200;Initial Catalog=BestRetailSolution"/>
</nhibernate>
<appSettings/>
<connectionStrings/>
<system.web>
<httpModules>
<add type="NHibernateHttpModule" name="NHibernateHttpModule"/>
</httpModules>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="ICSharpCode.SharpZipLib, Version=0.84.0.0, Culture=neutral, PublicKeyToken=1B03E6ACF1164F73"/>
<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
Finally the code-behind page and what it's doing!
Quote:
protected void Page_Load(object sender, EventArgs e)
{
string myString = "12345";
ISession session = NHibernateHttpModule.CurrentSession;
IQuery query = session.CreateQuery("FROM DbUser");
IList result = query.List();
GridView1.DataSource = result;
GridView1.DataBind();
}