DB2 Time and System.TimeSpan conversion

DB2 Time and System.TimeSpan conversion

Old forum URL: forums.lhotka.net/forums/t/10978.aspx


dblwizard posted on Monday, December 12, 2011

Howdy,

I'm working with CSLA and DB2 and running into an issue.  DB2 has a "TIME" type that maps to a .net TimeSpan type.  But the CSLA datareader object does not have a "GetTime" or "GetTimeSpan" function.

2 Questions:

1.  Can we get that added to the CSLA library.

2.  Any suggestions as a way to get around this in the mean time?

Thanks

dbl

JonnyBee replied on Monday, December 12, 2011

You can create your own subclass and extend SafeDataReader like this:

  public class MySafeDataReader : SafeDataReader
  {
    public MySafeDataReader(IDataReader dataReader ) : base(dataReader)
    {
    }
 
    public System.TimeSpan GetTime(string field )
    {
      // implementation goes here......
    }
  }

Copyright (c) Marimer LLC