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: assembly mapping question
PostPosted: Thu Feb 14, 2008 2:58 am 
Newbie

Joined: Wed Feb 13, 2008 2:17 pm
Posts: 4
I am trying to map directly to the C# class ListItem. ListItem is under the namespace System.Web.UI.Controls, and the assembly is System.Web. (for those who didn't know that) I can get this mapping to work if I put the System.Web.dll in my bin directory. My question is can I map this assembly without placing the *.dll in my bin directory?


Top
 Profile  
 
 Post subject: could really use some feed back here
PostPosted: Fri Feb 15, 2008 10:51 am 
Newbie

Joined: Wed Feb 13, 2008 2:17 pm
Posts: 4
Has anybody even tried this, I don't think its too far of a stretch to think it can be done. When it comes down to it all I need to know is if you can map to an assembly that isn't in the bin folder.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 15, 2008 12:40 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
Yes, as long as the class in question follows the POCO rules for NH persistable objects. See the docs.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 15, 2008 12:54 pm 
Newbie

Joined: Wed Feb 13, 2008 2:17 pm
Posts: 4
ok, well, I looked at the docs, the only thing the class has going against it is that it is sealed. so unfortunately that means that I can't inherit from the class. but i have successfully pulled items in as ListItems when the System.Web dll was in my bin directory. I guess the main issue now is how do how do I make nHibernate resolve the assembly when it is not in the bin. I'm sorry but I didn't see anything that explicitly states how to do that.


Top
 Profile  
 
 Post subject: Type resolution breaking change from 1.0.4 to 1.2.1?
PostPosted: Tue Feb 19, 2008 1:04 am 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
Serendipity, I just now ran into this problem myself. I have a mapped object that uses an enum from System.Web. This used to work in 1.0.x, but now upgrading to 1.2.1 for this component broke it. It now chokes (as does yours) at add assembly.

The problem is that there is some breaking change that is affecting how types in the mapping files are resolved. I don't know that it is a "must be in the bin directory" issue (though that might resolve it, you're right that there should be a better way).

So, I'm going to try to work this out, but first I'll send up the question newly formatted for anyone that might know (do the devs read the forums anymore?):

What breaking changes in mapping type resolution were there from 1.0.x to 1.2.x, and what are the workarounds?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 1:22 am 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
Yep, it was right there in the first 1.2.0 beta: NH-353 ( http://www.covalentsw.com:8080/browse/NH-353 ): Assembly.LoadWithPartialName is obsolete in .NET2. Therefore, you have to use a fully qualified assembly name in your mapping, or use the <runtime> section in your app.config, a la:

Code:
<runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <!-- this is needed by UtilityTest/ReflectHelperFixture.TypeFoundInNotLoadedAssembly() -->
            <qualifyAssembly
                partialName="System.Web"
                fullName="System.Web, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, Culture=neutral"
            />
        </assemblyBinding>
    </runtime>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 10:20 am 
Newbie

Joined: Wed Feb 13, 2008 2:17 pm
Posts: 4
Thanks for the help! I couldn't get the <runtime> configuration to work, but fully quantifying the name did.


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.