-->
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.  [ 6 posts ] 
Author Message
 Post subject: I Dont get it:TypeLoadException:Could not loadType ASP/VB.NE
PostPosted: Mon May 08, 2006 5:17 pm 
Newbie

Joined: Mon May 08, 2006 4:29 pm
Posts: 3
Location: Melbourne, Australia
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 5:31 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
Quote:
<property name="Description" column= "Description" type="String" length="50"/>

there is an extra space between the column= and "Description". take that out....


Top
 Profile  
 
 Post subject: that doesnt make any difference
PostPosted: Thu May 11, 2006 2:52 am 
Newbie

Joined: Mon May 08, 2006 4:29 pm
Posts: 3
Location: Melbourne, Australia
I change it with no effect, Im having the same problem

_________________
April Staines
Melbourne Australia


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 5:28 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
april,

i'm sorry that i didn't see your response earlier. i'm guessing you've solved the problem?


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 20, 2006 7:19 pm 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
As I couldn't download your project from the url you posted I can't say for sure what your problem is. From your post I saw a problem in the setter for the Description property, should be:
Code:
_Description = Value


but this problem shouldn't give you that exception.

Cheers,
Radu


Top
 Profile  
 
 Post subject: I solved the problem, namespace error
PostPosted: Sun May 21, 2006 3:27 am 
Newbie

Joined: Mon May 08, 2006 4:29 pm
Posts: 3
Location: Melbourne, Australia
I found that I had incorrectly labled the namespaces and as such couldnt load the settings from the mapping file.

Silly mistake really, but I had followed a C# example a little too closely instead of thinking for myself.

All works now, Im a fast growing fan of NHibernate

lotsa lurve

April

_________________
April Staines
Melbourne Australia


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.