Problems mapping the TimeStamp field using MapAllProperties

Topics: Data Access Application Block
May 13, 2010 at 4:01 AM


I am always getting null for the TimeStamp field mapping using the MapBuilder<TResult>.MapAllProperties() method

Is there anything specific to do to map a TimeStamp field?


Prajeesh Prathap

May 13, 2010 at 4:16 AM

Looks like this is another type which can't be handled in the default row mapper.  You can vote for this item in the issue tracker -  This is for enumerations so you should also specify the case for the TimeStamp field. 

As a workaround for now, you would need to create your own implementation of IRowMapper.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

May 13, 2010 at 4:17 AM


I forgot to check the .Func() option.

I am able to retrieve data now by doing this

.Map(x => x.Version).WithFunc(dataRecord =>                     {                        int index = dataRecord.GetOrdinal("Version");                        if (!dataRecord.IsDBNull(index))                        {
                            byte[] version = new Byte[(dataRecord.GetBytes(index, 0, null, 0, int.MaxValue))];                            dataRecord.GetBytes(index, 0, version, 0, version.Length);                            return version;                        }                        return null;                    })

May 13, 2010 at 4:18 AM

btw, thanks for the quick reply :)

May 13, 2010 at 4:19 AM

Glad to help.

Yes, I forgot you can specify it that way without creating a class that implements IRowMapper.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.