IResultSetMapper..possible this structure?

Topics: Data Access Application Block
Feb 9, 2011 at 3:51 PM
Edited Feb 9, 2011 at 4:14 PM

As far as I know, IResultSetMapper<T>, T should be enumerable.
For example, let's say I have these Custom classes

class Data {
   public int Col1 { get; set;}
   public int Col2 { get; set;}
   public int Col3 { get; set;}
}

class Test<T> : List<T> {
   public int ExtraVariable { get; set;}
}

My sql returns multiple resultset, something like this.

ExtraVariable
10

Col1 Col2 Col3
1      2      3
4      5      6

What I wanted is that i want to access the ExtraVariable and the list both from the returned object.
For example, it should be something like this..

Test<Data> myTestObject = db.ExecuteSprocAccessor<Test<Data>>(...., myResultSetMapper..);

So myTestObject should contain value like this...


myTestObject.ExtraVariable == 10
myTestObject[0].Col1 == 1;
myTestObject[0].Col2 == 2;
myTestObject[0].Col3 == 3;
myTestObject[1].Col1 == 4;
myTestObject[1].Col2 == 5;
myTestObject[1].Col3 == 6;

I really wasn't able to create a class implements the
IResultSetMapper to support this structure.
Any idea?
If you could give me some idea how to achieve this, I appreciate it.

Thanks,

Feb 9, 2011 at 4:57 PM

Never mind. I figured this out.

Thanks,