Problems mapping the TimeStamp field using MapAllProperties

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

Hi,

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?

Regards

Prajeesh Prathap

May 13, 2010 at 3: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 - http://entlib.codeplex.com/WorkItem/View.aspx?WorkItemId=27021.  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.
entlib.support@Avanade.com

May 13, 2010 at 3:17 AM

Sorry,

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 3:18 AM

btw, thanks for the quick reply :)

May 13, 2010 at 3: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.
entlib.support@Avanade.com