Problem saving an object created dynamically with reflection

2011-06-10 Thread Regis Dubois
Hi, I am trying to get the following to work without much success: This class is read from file and compiled in memory: using System; using Castle.ActiveRecord; using iTradeStorage.ValueObjects; namespace iTradeStorage.ValueObjects { [ActiveRecord] public class iTradeType1 :

RE: Problem saving an object created dynamically with reflection

2011-06-10 Thread Nicholas Kilian
I actually had this same problem the other day, eventually found an obscure reference to the actual error in an NH bug report. You need to handle the AppDomain.CurrentDomain.AssemblyResolve event and return your compiled assembly - do this before initialising ActiveRecord. -Original

Re: Problem saving an object created dynamically with reflection

2011-06-10 Thread Regis Dubois
Hi and thanks Nicholas, I am not sure I understand the solution you propose? Plus the entire purpose of the exercise for me, is to dynamically create assembly AFTER the active record initialization and to register it after it's been compiled on the fly. Note that I have tried to explicitly add

RE: Problem saving an object created dynamically with reflection

2011-06-10 Thread Nicholas Kilian
How is AR/NH meant to know about your type if it's not part of the initialisation? The problem is with NH and how it loads assemblies during configuration, which is why you should handle the AssemblyResolve event and return your runtime compiled assembly. -Original Message- From:

RE: Problem saving an object created dynamically with reflection

2011-06-10 Thread Nicholas Kilian
Public Property CurrentAssembly As Reflection.Assembly Public Property CurrentAssemblyName As String Public Property CurrentAssemblyFullName As String Public Sub New(ByVal asm As Reflection.Assembly) ''Code to set properties. AddHandler AppDomain.CurrentDomain.AssemblyResolve,

Aw: Problem saving an object created dynamically with reflection

2011-06-10 Thread Markus Zywitza
The exception sounds like it needs an integer id, since [PrimaryKey] is a shortcut for using Identity. You can also try [PrimaryKey(PrimaryKeyType.Assigned)] instead. -Markus -- You received this message because you are subscribed to the Google Groups Castle Project Users group. To view this