How do you tell Ibatis that you don’t want to lazy load anything more.

 

For instance if you want send the objects through soap.

 

Example:

SqlMapper sqlMap = Mapper.Get();

 

List<ClassWithLazyLoadedList> list = GetListFromDB(sqlMap)

 

Do_some_logic_wich_lazy_loades_some_of_the_lists(sqlMap,list);

 

Signal_IBatis_to_not_lazy_load_anyting_more(sqlMap);

 

string serializedObjects = Serialize(list);

 

 

/Okku

 


From: Gilles Bayon [mailto:[EMAIL PROTECTED]
Sent: den 20 april 2006 22:48
To: [email protected]
Subject: Re: Lazy loading and generics

 

The code in SVN doesn't support lazy loading for generic list as it is not finish.


I don't understand the 2nd question.

 

-Gilles
 

On 4/20/06, Okku Touronen <[EMAIL PROTECTED]> wrote:

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