-->
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.  [ 7 posts ] 
Author Message
 Post subject: External interface inheritance, is possible!?
PostPosted: Sat Nov 19, 2005 10:54 pm 
Hello all,

I'm testing a demo application with nhibernate and I'm found problems, already search in documentation but don't found. My test is such as bellow:

1. I has a IObject interface in myFramework.ddl.
2. I create a new class library for my business objects, myBO.dll.
3. I create the People class that implements the IObject in myBO.dll.
4. In myBO.dll I create the mapping files with embebed resources.
5. I create a new application (in the reallity a class library to NUnit) that use myBO.dll and has the code to work with NUnit (configuration, sessions and etc..).

The problem is raised when I execute the Configuration.BuildSessionFactory method, I get the exception:

-----------------------------------------------------------------------------
A first chance exception of type 'System.InvalidOperationException' occurred in nhibernate.dll

Additional information: Referenced class 'myBO.People' has base class or interface 'myFramework.Persistence.IObject' defined in an assembly that is not referenced. You must add a reference to assembly 'myFramework'.
-----------------------------------------------------------------------------

Anybody can help me, anybody know how solve it!?


Thank's.....

[]'s
FernandoVM


Top
  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 6:26 am 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Hi FernandoVM,

The exception is actually telling you exactly what you need to do. Your application has a reference to your myBO.dll but since myBO.dll exposes the People class which is implements an interface defined another assembly (myFramework.dll) you must add a reference to that assembly.

If you're using VS.Net then right click on the References folder in the Solution Explorer, select Add Reference and add a reference to your myFramework.dll.

Hope that helps,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 8:12 am 
Hi Symon,

Thank's by your attention. The problem is it, both my application and myBO.dll already has a reference to myFramework.dll. Observe that exception is raised in NHibernate, not in my application, see:

A first chance exception of type 'System.InvalidOperationException' occurred in nhibernate.dll.

:(

And now, what I can do!?
Any help will be welcome!

Thank's..

[]'s
FernandoVM


Top
  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 10:08 am 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Hmmm. Sorry about that FerdinandoVM - I guess I misunderstood the issue at hand!

I'm not sure if it will help, but maybe adding the myFramework assembly using the AddAssembly method of the Configuration object might work?

Or importing the IObject interface using the AddImport method of the Mappings object returned by the CreateMappings method of the Configuration object?

eg:

Code:
cfg.CreateMappings().AddImport([type], [alias]);


Don't know if either of these will work - just suggestions.

Cheers,

Symon.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 10:16 am 
s.rottem wrote:
Hmmm. Sorry about that FerdinandoVM - I guess I misunderstood the issue at hand!

No problem.. :)

Thank's again by your attention.

I already try it, I add the bellow lines in myBO.dll:

Code:
cfg.AddAssembly("myFramework");


and try this also:

Code:
System.Type typeToImport = typeof(myFramework.Persistence.IObject);
cfg.CreateMappings().AddImport(typeToImport.AssemblyQualifiedName, typeToImport.FullName);



:?

And now, more any idea??

Thank's...

[]'s
FernandoVM[/code]


Top
  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 6:10 pm 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Sorry - that's my bag of tricks emptied. Anyone else got any bright ideas?

Symon


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 8:35 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Try to isolate the problem as much as possible...

You may even build a "fake" solution with fake interfaces/classes to reproduce the problem.
If you succeed and build a fix that should be applied to NHibernate, then post the TestCase (NUnit :) ) and the patch in a new JIRA issue (http://jira.nhibernate.org/).

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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