Sorry! I was think of an out parameter in StoredProcs. Did you try using the Castle Proxy rather than LinFu? I guess you need to submit a JIRA report with a test.
John Davidson On Fri, May 7, 2010 at 11:09 AM, nadav s <[email protected]> wrote: > i don't think you got me > i'm talking about a regular entity that has (well not anymore, but i wanted > it to have) a method with an out parameter -> regular method > > public virtual int Method(out string outString) > > something like that > and the linfu fails to create a proxy just because the out parameter > > On Fri, May 7, 2010 at 4:06 PM, John Davidson <[email protected]>wrote: > >> See http://www.richter-web.info/Wordpress/?p=132 which may help. It >> gives one method of accessing output parameters using NHibernate, but in a >> more ADO type approach. >> >> John Davidson >> >> On Fri, May 7, 2010 at 8:42 AM, nadav s <[email protected]> wrote: >> >>> the LinFu proxy is failing when fatching a child entity that its father >>> (many-to-one) has a method with out parameter. >>> removing the out parameter from the method makes it work fine >>> >>> is it a known bug? >>> i don't know how hard it is to make it work cause i don't know >>> Reflection.Emit very well, but i think there at least should be a good error >>> method. >>> the inner exception message i get below is >>> just System.ArgumentNullException: Value cannot be null.Parameter name: type >>> >>> the outer exception is just "Creating a proxy instance failed". >>> took a lot of time to figure out that the out parameters method is the >>> one causing the trouble >>> >>> father entity: >>> >>> public class Department >>> { >>> public virtual int Id { get; set; } >>> public virtual IDictionary<int,Employee> Employees {get;set;} >>> >>> public virtual void OutParametersMethod(out string outString) >>> { >>> outString = ""; >>> } >>> } >>> >>> the child: >>> >>> public class Employee >>> { >>> public virtual int Id { get; set; } >>> >>> public virtual Department Department { get; set; } >>> } >>> >>> The mapping of the many to one (in Employee.hbm.xml) (is trivial): >>> >>> <many-to-one name="Department" class="TestVSOracle.Entities.Department, >>> TestVSOracle" >>> column="DEPARTMENT_ID" not-null="false" lazy="proxy"/> >>> >>> >>> >>> >>> >>> full exception.ToString(): >>> >>> >>> NHibernate.HibernateException: Creating a proxy instance failed ---> >>> System.ArgumentNullException: Value cannot be null.\r\nParameter name: type >>> >>> >>> at System.Reflection.Emit.ModuleBuilder.GetTypeTokenWorkerNoLock(Type >>> type, Boolean getGenericDefinition)\r\n at >>> System.Reflection.Emit.ModuleBuilder.GetTypeTokenInternal(Type type, Boolean >>> getGenericDefinition)\r\n at >>> System.Reflection.Emit.ILGenerator.Emit(OpCode opcode, Type cls)\r\n at >>> LinFu.DynamicProxy.DefaultMethodEmitter.SaveRefArguments(ILGenerator IL, >>> ParameterInfo[] parameters)\r\n at >>> LinFu.DynamicProxy.DefaultMethodEmitter.EmitMethodBody(ILGenerator IL, >>> MethodInfo method, FieldInfo field)\r\n at >>> LinFu.DynamicProxy.DefaultyProxyMethodBuilder.CreateProxiedMethod(FieldInfo >>> field, MethodInfo method, TypeBuilder typeBuilder)\r\n at >>> LinFu.DynamicProxy.ProxyFactory.CreateUncachedProxyType(Type[] >>> baseInterfaces, Type baseType)\r\n at >>> LinFu.DynamicProxy.ProxyFactory.CreateProxyType(Type baseType, Type[] >>> baseInterfaces)\r\n at LinFu.DynamicPro >>> xy.ProxyFactory.CreateProxy(Type instanceType, IInterceptor interceptor, >>> Type[] baseInterfaces)\r\n at >>> NHibernate.ByteCode.LinFu.ProxyFactory.GetProxy(Object id, >>> ISessionImplementor session) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate.ByteCode.LinFu\\ProxyFactory.cs:line >>> 22\r\n --- End of inner exception >>> >>> stack trace ---\r\n at >>> NHibernate.ByteCode.LinFu.ProxyFactory.GetProxy(Object id, >>> ISessionImplementor session) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate.ByteCode.LinFu\\ProxyFactory.cs:line >>> 30\r\n at >>> NHibernate.Tuple.Entity.AbstractEntityTuplizer.CreateProxy(Object id, >>> ISessionImplementor session) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Tuple\\Entity\\AbstractEntityTuplizer.cs:line >>> 236\r\n at >>> NHibernate.Persister.Entity.AbstractEntityPersister.CreateProxy(Object id, >>> ISessionImplementor session) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Persister\\Entity\\AbstractEntityPersister.cs:line >>> 3750\r\n at NHibernate.Event.Default.DefaultLoad >>> EventListener.CreateProxyIfNecessary(LoadEvent event, IEntityPersister >>> persister, EntityKey keyToLoad, LoadType options, IPersistenceContext >>> persistenceContext) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Event\\Default\\DefaultLoadEventListener.cs:line >>> 223\r\n at >>> NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad(LoadEvent >>> event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Event\\Default\\DefaultLoadEventListener.cs:line >>> 154\r\n at >>> NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, >>> LoadType loadType) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Event\\Default\\DefaultLoadEventListener.cs:line >>> 86\r\n at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType >>> loadType) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Impl\\SessionImpl.cs:line >>> 2554\r\n at NHibernate.Impl.SessionImpl.InternalLoad(String entityName, >>> Object id, Boolean eager, Boole >>> an isNullable) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Impl\\SessionImpl.cs:line >>> 1427\r\n at NHibernate.Type.EntityType.ResolveIdentifier(Object id, >>> ISessionImplementor session) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Type\\EntityType.cs:line >>> 386\r\n at NHibernate.Type.EntityType.ResolveIdentifier(Object value, >>> ISessionImplementor session, Object owner) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Type\\EntityType.cs:line >>> 424\r\n at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, >>> Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, >>> PostLoadEvent postLoadEvent) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Engine\\TwoPhaseLoad.cs:line >>> 78\r\n at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList >>> hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean >>> readOnly) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loader\\Loader.cs:line >>> 592\r\n at NHibernate.Loader.Loa >>> der.DoQuery(ISessionImplementor session, QueryParameters queryParameters, >>> Boolean returnProxies) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loader\\Loader.cs:line >>> 460\r\n at >>> NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor >>> session, QueryParameters queryParameters, Boolean returnProxies) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loader\\Loader.cs:line >>> 236\r\n at NHibernate.Loader.Loader.DoList(ISessionImplementor session, >>> QueryParameters queryParameters) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loader\\Loader.cs:line >>> 1650\r\n at >>> NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, >>> QueryParameters queryParameters) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loader\\Loader.cs:line >>> 1569\r\n at NHibernate.Loader.Loader.List(ISessionImplementor session, >>> QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loa >>> der\\Loader.cs:line 1563\r\n at >>> NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) >>> in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Loader\\Criteria\\CriteriaLoader.cs:line >>> 73\r\n at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList >>> results) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Impl\\SessionImpl.cs:line >>> 2001\r\n at NHibernate.Impl.CriteriaImpl.List(IList results) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Impl\\CriteriaImpl.cs:line >>> 246\r\n at NHibernate.Impl.CriteriaImpl.List[T]() in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Impl\\CriteriaImpl.cs:line >>> 257\r\n at NHibernate.Criterion.QueryOver`1.List[U]() in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Criterion\\QueryOver.cs:line >>> 56\r\n at >>> NHibernate.Criterion.QueryOver`1.NHibernate.IQueryOver<TRoot>.List[U]() in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\NHibernate\\Criterion\\QueryOver.cs:line >>> 148\r\n at TestVSOracle.Program.LearnQuery >>> Over(ISession s) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\TestVSOracle\\Program.cs:line >>> 143\r\n at TestVSOracle.Program.Main(String[] args) in >>> D:\\nhibernate_svn\\trunk\\nhibernate\\src\\TestVSOracle\\Program.cs:line >>> 33" >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<nhusers%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
