Hello I searched the issue tracker and found

IBATISNET-105: Lazy load support for Strong typed collections and single Items

 

I have a similar problem (I think) that lazy loading of a generic list doesn’t work.

 

It seems to me that the proxy that is generated is not correct. So I get a casting exception.

The following code works, so the EmitPropertyAccessor.Set method should work only if the proxy was correct.

 

            ProxyGenerator gen = new ProxyGenerator();

object proxy = gen.CreateClassProxy(typeof(List<T>), new Interceptor());

            IList<T> ilist = (IList<T>)proxy;

 

I can’t see any code in the LazyLoadList.NewInstance that is creating a proxy of such kind.

 

Another question: How do I signal that the “connection” is over do not lazy load anything more, for example if I want to serialize an object.

 

Regards Okku Touronen

 

 

 

Exception:

 

Unable to cast object of type 'ProxyInterfaceCollectionsArrayList_IList_ISerializable' to type 'System.Collections.Generic.List`1[lejistest.ACL]'.   at MemberAccessorForlejistest.GroupaccessControlList.Set(Object , Object )

   at IBatisNet.Common.Utilities.Objects.Members.EmitPropertyAccessor.Set(Object target, Object value) in C:\dev\misc\Ibatis\IBatisNet.Common\Utilities\Objects\Members\EmitPropertyAccessor.cs:line 130

   at IBatisNet.DataMapper.MappedStatements.MappedStatement.SetObjectProperty(RequestScope request, ResultMap resultMap, ResultProperty mapping, Object& target, IDataReader reader) in C:\dev\misc\Ibatis\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs:line 1360

   at IBatisNet.DataMapper.MappedStatements.MappedStatement.ApplyResultMap(RequestScope request, IDataReader reader, Object resultObject) in C:\dev\misc\Ibatis\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs:line 264

   at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T](IDalSession session, Object parameterObject, IList`1 resultObject, Boolean forceLazyLoad) in C:\dev\misc\Ibatis\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs:line 945

   at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String statementName, Object parameterObject, IList`1 resultObject, Boolean forceLazyLoad) in C:\dev\misc\Ibatis\IBatisNet.DataMapper\SqlMapper.cs:line 1150

   at DataAccess.GroupDataAccess.GetAllGroups(SqlMapper sql, Boolean forceLazyLoad) in C:\dev\LejisTest\Test1\Test1\DataAccess\groupDataAccess.cs:line 34

   at Test1.Form1.LoadGroups() in C:\dev\LejisTest\Test1\Test1\Form1.cs:line 81

Reply via email to