AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

How to use Generics with the AdFactum ObjectMapper .NET

Posted by Gerhard Stephan on September 13th, 2007

It’s not a surprise, but worth to say: The AdFactum ObjectMapper .NET does fully supports the Generics of the dotNet Framework 2.0. Having a first look at the interface of the ObjectMapper class, nothing looks like, that Generics can be used.

For Example: public IList FlatSelect(Type type)

Most of all, this is because of the backward compatibility to the dotNet Framwork 1.0. But let us have a look at the following use case.

List<User> users = new List<User>(

new ListAdapter<User>(

   mapper.FlatSelect(typeof (User), userCondition)));


The AdFactum ObjectMapper .NET provides a helper class called ListAdapter to bridge the gap between the untyped IList interface and the Generics, used by the dotNet Framework 2.0. The base principles of the ListAdapter can be found here.

That’s all for now.


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>