[nem-en] Nullable types

NoiseEHC NoiseEHC at freemail.hu
Mon Jan 16 00:29:24 CET 2006


I did not check .net 2.0's database support yet but most likely it is
useless if you use WinForms. (ASP.NET is different thought).
see:
http://NoiseEHC.fw.hu/databind.html

So one goal of Nemerle should be to create some macro powered
database layer.

DataAdapter fills in a DataTable and you have to know that DataTable
stores all of its values as boxed ValueTypes (or Objects). So there will
be no Nullable<> conversion.
I looked at DataReader and it is a shame that MS missed something
so plausible (from an MS employee):
"Julia, unfortunately, you’re not missing something on the DataReader. 
The Nullable(Of T) work just didn’t come online in full fidelity in time 
for us to get this baked into the ADO.net runtime. In addition to adding 
this functionality to all the runtime components, we also needed to find 
a reasonable backwards compat story for all the 1.0/1.1 apps that get 
upgraded. However, we did have time to integrate Nullable types into 
much of the Data Design Time features as well as some of the DataBinding 
infrastructure. I’ve posted info about this on my blog @ 
http://blogs.msdn.com/vbteam/archive/2005/01/12/351495.aspx. 
Essentially, we were able to resolve the impedance mismatch with DBNull, 
Null/Nothing and Nullable(Of T) when updating the database through our 
new typed dataadapters referred to as TableAdapters. We just didn’t have 
the time to do the same for reading out of the database. This is 
something we’ll be doing in the future though. "
See the link!!!

BTW I would vote for a Nemerle extension, eg naming types as ?typename 
or typename?. This would simply mean a shortcut to Nullable.[typename]. 
Where is that dot? :)
Ehh, probable we should fix the generics notation as ALWAYS requiring 
the extra dot. You can see in the D "specification" that they use
templatename!(templateparam1, ...) as a template instantiation... (I 
myself does not think that D will take off...)

> There are two common scenarios when reading data:
> - through DataAdapter, e.g. filling the DataTable object with contents
> of DB to show it automatically in a Windows Forms grid. In this case
> my experiments show, that a result DataTable contains the specific
> values (int, bool, string, etc.) if they are not null in DB and
> DbNull.Value otherwise. I'm not sure what is exactly DataAdapter doing
> when filling DataTable, but it does some kind of conversions
>
> - directly from DataReader obtained after calling DbCommand's
> ExecuteReader(), where we call methods like GetInt, GetString - I
> didn't check what those returning value types will actually give me,
> but surely it will not be the real value... So maybe there is some way
> to do reader.GetNullableInt()? Or do I have to create my own functions
> for converting the result  of GetObject() to nullable specific values?
> (well, these ones would be easy to write or even generate by macro,
> but maybe there is some builtin functionality).
>
>   



More information about the devel-en mailing list