Closed GoogleCodeExporter closed 9 years ago
Blake,
I think this is a hang over from CSLA smart dates Nullable(of T) change. It
applies
to Insert and Update Stored procedure statements.
You have code in the BuildCommandParameters functions that should apply to any
property that is nullable. See
Templates\Frameworks\Csla\Source\CodeSmith.SchemaHelper.VisualBasicExtensions\Me
mberCollectionExtensions.cs
about line 124. I think it should be just a case of using the string format
If Member.Isnullable
{
cast = string.Format("IIf({0}{1}.HasValue, DirectCast({0}{1}.Value, {2}),
System.DBNull.Value))", castPrefix, propertyName,member.DataType);
}
Else
{
// cast = //All your normal code here.
}
Excuse my C# syntax.
Original comment by JenasysD...@gmail.com
on 22 Feb 2010 at 10:14
Blake,
Private Sub Map(ByVal reader As SafeDataReader) Also incorrectly reads Null
data into
the properties. This is particularly problematic with nullable dates.
Eg. LoadProperty(_lastUpdatedDateProperty,
reader.GetDateTime("ConsultLastUpdated"))
If reader.Item("ConsultLastUpdated") = Nothing then the
GetProperty(lastUpdatedDateProperty).HasValue = True and .Value = "#12:00:00
AM#"
which is commpletely incorrect.
If you create a Nunit test to Save a new record, then retrieve that record and
try
and update a different field the SP will fallover with Exception:.
----> Csla.Reflection.CallMethodException : DataPortal_Update method call failed
----> System.Data.SqlTypes.SqlTypeException : SqlDateTime overflow. Must be between
1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Original comment by JenasysD...@gmail.com
on 22 Feb 2010 at 10:55
I've done a unit test if you use the following sytax the nullable property loads
correctly.
LoadProperty(_lastUpdatedDateProperty, reader.Item("ConsultLastUpdated"))
The Csla.SafeDataReader.Get* methods are incorrectly converting the data to
"safe"
values in the Private Sub Map(ByVal reader As SafeDataReader) code.
\Templates\Frameworks\Csla\VisualBasic\Common\MapDataReader.cst
Suggested change attached
Original comment by JenasysD...@gmail.com
on 22 Feb 2010 at 11:16
Hello,
This has been fixed in the latest nightly build.
Thanks
-Blake Niemyjski
Original comment by bniemyjski
on 23 Feb 2010 at 12:50
Original comment by bniemyjski
on 23 Feb 2010 at 11:31
Original comment by bniemyjski
on 15 Jul 2010 at 2:21
Original issue reported on code.google.com by
JenasysD...@gmail.com
on 22 Feb 2010 at 6:59