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.  [ 1 post ] 
Author Message
 Post subject: Adding dynamic type to NHibernate configuration
PostPosted: Mon May 10, 2010 3:25 pm 
Newbie

Joined: Thu Apr 15, 2010 1:57 pm
Posts: 9
Hi,

I have a situation in which I have to add a type of an object to nhibernate configuration at run time. We would know the class name and data members of the class only at run time. We want to create a separate data table on the database server for each of these dynamic types. My initial idea was to use the ".NET TypeBuilder" to create the new type and use the "NHibernate.Configuration.AddClass" to register the new type and then provide the mapping for the new type using "NHibernate.Configuration.AddXMLString" . After this we expect that this new dynamic type can now we used like any other class type we use with Nhibernate.

But I am running into issues / exceptions, When using the "NHibernate.Configuration.AddClass", getting an exception as "The invoked member is not supported in a dynamic assembly." I was able to debug the NHibernate code and it is looking for the Mapping file for the new type we added and raising this exception. So I tried the other way around adding the mapping file first, the call "NHibernate.Configuration.AddXMLString" when called first fails with an exception "Could not compile mapping document".

My suspicion is that these method of the "NHibernate.Configuration.AddClass/AddXMLString" are not intended for registering the new dynamic types. Can someone suggest me an approach for our problem


Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.