DateTimeMode - can't specify in Data Access Block

Topics: Data Access Application Block
Jun 20, 2007 at 1:10 PM
I need to set the DateTimeMode of columns in a dataset/datatable to be in UTC time. However I can't do this with the Data Access Application Block. For Enterprise applications times will normally be in UTC, so it's strange that the "Enterprise" Library doesnt support UTC.

It can be done manually if I'm using bare ADO.NET, by calling FillSchema, setting the the DateTimeMode, then calling Fill. e.g.

DataTable dt = new DataTable("TryIt");
//*****************
adapter.FillSchema(dt, SchemaType.Source);
dt.Columns"utc".DateTimeMode = DataSetDateTime.Utc;
dt.Columns"local".DateTimeMode = DataSetDateTime.Local;
//*****************
adapter.Fill(dt);

Full example at:
http://www.developerfood.com/how-do-i-set-the-datetimemode-property-when-filling-a-datatable/microsoft-public-dotnet-framework-adonet/2265ac53-0d86-429f-8b0a-5e3683202c12/article.aspx

But how can I set DateTimeMode = DataSetDateTime.Utc in the DAAB 2.0 ? Does this need raising as an EntLib bug ?

Thanks,
Andy Mackie
Jun 21, 2007 at 1:07 PM
Hi Andy,

This feature is not currently supported by Enterprise Library. As you describe, the current solution requires three steps using raw ADO.NET (filling the schema, updating the DateTime columns, and loading the actual data), while Entlib's DAAB goal is to simplify common operations through a high level API.
If this feature is to be supported by DAAB, how do you think it should be integrated into the current API? A configuration driven approach would avoid polluting the API but may be overkill for this feature.

Thanks,
Fernando