how to fill list of custom type objects using DAAB ? Please guide me

Topics: Data Access Application Block
May 22, 2010 at 8:50 AM


Thanks for your attention, time and sharing.

How DAAB can be used to fill list of custom objects ?

I am curious if a custom object ( for example User) composes an enum (for example UserType which can have values admin or member); than how  object (User) will be filled if null is coming as value for enum (UserType) ?

Please guide me on this issue.


thanks in anticipation

May 24, 2010 at 4:50 AM

Hi haansi,

You can check the documentation on how you can achieve returning a custom object using the DAAB Accessors, and

If the value queried from the database is null it will return 'null' as its value for the UserTypeproperty, though you just need to make sure that your UserType matches the data type defined in the database else you will encounter an InvalidCastException on the result of the accessor.

Try and see if utilizing the MapBuilder's Map(property).WithFunc(function) method will be useful with your current problem. By using this you can be able to customize a specific property result depending with the function that you have created and define.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.