Help with Nullable, Default and Single/Double

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
MartinHT
Posts: 12
Joined: Thu 28 Aug 2014 09:49

Help with Nullable, Default and Single/Double

Post by MartinHT » Fri 05 Sep 2014 15:38

Hi:

I have a database that has a column of type FLOAT that accepts nulls. When mapping this table with Entity Developer (stand alone or VS2013 embedded) I'm getting trouble at runtime, more preciesly it complains about:
Actual type: Single
Expected type: System.Double

I can resolve the problem by setting the column property to Nullable=False, this now leads me to my questions:

1. If I set Nullable=False on a column that does support nulls in the database, will the ORM convert nulls to the Default Value?
2. When setting Default Value on a DATETIME column, what format should the date be? In other words, is that evaluated at compile time or runtime, as the localizations may be different. This also goes for numeric value formats (decimal points etc.)

Thanks,
Martin.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Help with Nullable, Default and Single/Double

Post by MariiaI » Mon 08 Sep 2014 13:31

Please specify the following details:
- the version of LinqConnect;
- the DBMS you are working with, is it MySQL? its version;
Actual type: Single
Expected type: System.Double
Please send us the model you are working with and the DDL script for the database table. Also please specify the code with which this error occurs.
If I set Nullable=False on a column that does support nulls in the database, will the ORM convert nulls to the Default Value?
Yes.
When setting Default Value on a DATETIME column, what format should the date be
There are two possible ways:
- set the Default Value for the "datetime" property in the model, for example: CURRENT_TIMESTAMP, or 08.09.2014, or 08/09/2014;
- set the Auto Generated Value to True for this property in the Property Editor.
In first case, the value for the "datetime" field will be set on the client side and, in the second case, the value for this field will be set on the server side.

MartinHT
Posts: 12
Joined: Thu 28 Aug 2014 09:49

Re: Help with Nullable, Default and Single/Double

Post by MartinHT » Tue 09 Sep 2014 07:13

Hi:

I am using LinqConnect 4.4.557 connected to SQL Server 2008 R2.

When I run into the error again I will send the requested information to you. It has happened on three occasions on different databases so it should not take long to reproduce.

Regards,
Martin.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Help with Nullable, Default and Single/Double

Post by MariiaI » Tue 09 Sep 2014 11:35

When I run into the error again I will send the requested information to you.
We are looking forward to your reply with the additional information.

Post Reply