Hello Aleksey,
i created a small example displaying the issue.
We have a simple class:
Code: Select all
public class DummyData
{
public string Name { get; set; }
public virtual Nullable Birthday
{
get;
set;
}
}
Within the Report on DataBand1 I have a BeforePrint event trigger:
Code: Select all
if( !MyData.Birthday.HasValue )
{
// do something
}
However i get a runtime error, because the MyData.Birthday is a
datetime and no datetime(nullable). If you change the datatype to
datetime(nullable) everything is fine.
I tried casting to and object and recasting it back to a Nullable
but still the same runtime error.
I created a workaround with the NotNullWrapper as in my first post
Code: Select all
if( MyData.Birthday_NotNullWrapper == DateTime.MinValue )
{
// do something
}
but this requires deep copying the content of the class, because the class
code is autogenerated by the entity framework.
-- edit -- :
I checked the Report File - so nullables are possible - but they aren't detected
properly:
Code: Select all
MyData
Name,System.String
Birthday,System.DateTime
Birthday_NotNullWrapper,System.DateTime
_ID,System.Int32
_Current,System.Object
MyData
MyData
vs.
Code: Select all
MyData
Name,System.String
Birthday,System.Nullable`1[System.DateTime]
Birthday_NotNullWrapper,System.DateTime
_ID,System.Int32
_Current,System.Object
MyData
MyData