ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikhil Vaghela" <nikhil.vagh...@in.v2solutions.com>
Subject Problem with Generic IList as return type.
Date Mon, 28 Aug 2006 04:56:04 GMT
Hi,

 

Problem overview

I am going to use iBatis.Net latest version which supports .NET 2.0.

 

I have a wrapper class as given in the old example NPetShop that is
BaseSQLMapDao in my Persistance layer which is having methods like
"ExecuteQueryForList" which actually calls sqlMapper's QueryForList
method of iBatisNet.DataMapper

Now .NET 2.0 supports generic IList and iBatis also supports this
feature.

 

Actual problem

 

I will be calling ExecuteQueryForList method from my BuisnessObject's
sqlMapDao say for example "EmployeeSqlMapDao.cs" or
"DepartmentSqlMapDao.cs" in my persistence layer.

 

Now the problem is if I use genericsList my BaseSqlMapDao doest not know
which type of IList it is returning !!!!

e.g

public IList GetEmployeeListForDepartment(string DepartmentID)

{

return ExecuteQueryForList("GetEmployeesForDepartment", DepartmentID);


//above given is a method of BaseSqlMapDao class

}

 

this works fine 

but if I use generic IList like as follows

 

public IList<Employee> GetEmployeeListForDepartment(string DepartmentID)

{

return ExecuteQueryForList("GetEmployeesForDepartment", DepartmentID);


}

Now what will i be having as return type in this case for
ExecuteQueryForList as that method does not know which type of Objects
are stored in the Ilist!!!! And if I make its return type IList<Object>
i will have to cast it each and every item in IList<Object> to my
custome object's Ilist<MyCustomObject> which I don't want as its not
good method 

 

So how can I solve the problem ???? I hope I could describe my question
properly.

 

Any help will be greatly appreciated.

Thanks.

Nikhil.

 

 


Mime
View raw message