Hi,
I have searched and searched and I cant see that Im doing anything wrong. I've based my code on examples i have found, but most are C# and I need to work in VB.Net/ASP.NET for this job.
Im using 1.1 .NET, SQL2005, nhibernate:1.0.2.0
I get this error:
[TypeLoadException: Could not load type 'ActivityMeasure2.Reference.Application, ActivityMeasure2', check that type and assembly names are correct]
NHibernate.Util.ReflectHelper.ClassForName(String name)
NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
This is the code behind the webform
Code:
Namespace ActivityMeasure2.Reference
Public Class MainMeasure
Inherits System.Web.UI.Page
Public cfg As New NHibernate.Cfg.Configuration
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim query As String
query = "FROM Application"
cfg.AddAssembly("ActivityMeasure2")
Dim factory As ISessionFactory = cfg.BuildSessionFactory()
Dim session As ISession = factory.OpenSession()
DataGrid1.DataSource = session.CreateQuery(query).List()
End Sub
End Class
End Namespace
This is the class called "application"
Code:
Namespace ActivityMeasure2.Reference
Public Class Application
Private _ID As Integer
Private _Description As String
Public Property ApplicationId()
Get
Me.ApplicationId() = _ID
End Get
Set(ByVal Value)
_ID = Value
End Set
End Property
Public Property Description()
Get
Me.Description = _Description
End Get
Set(ByVal Value)
_Description = Description
End Set
End Property
End Class
End Namespace
The mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="ActivityMeasure2.Reference.Application, ActivityMeasure2" table="tbl_application">
<id name="ApplicationId" column="ID" type="Int32" length="4" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Description" column= "Description" type="String" length="50"/>
</class>
</hibernate-mapping>
THis is the table
Code:
CREATE TABLE [dbo].[tbl_Application](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Description] [varchar](50) NOT NULL,
[Obsolete] [bit] NOT NULL CONSTRAINT [DF_tblApplication_Obsolete] DEFAULT (0),
CONSTRAINT [PK_tbl_Application] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [Data]
) ON [Data]
The assembly is definately called "ActivityMeasure2"
Im at a loss to understand what I am doing wrong.
I have zipped & uploaded my project file here:
http://april.fmgirl.com/files/ActivityMeasure2.zip
if anyone is interested in having a look, perhaps I've just been up too late, or maybe Im just having another "blonde" day
Any help would be awesome!
April Staines
Melbourne Australia