Page 1 of 1

Errors in code generation when dealing with decimal

Posted: Wed 08 Dec 2010 19:18
by KW
I'm getting these errors in visual studio:

Error 17 Cannot implicitly convert type 'double' to 'decimal?'. An explicit conversion exists (are you missing a cast?)
Error 15 Literal of type double cannot be implicitly converted to type 'decimal'; use an 'M' suffix to create a literal of this type


It seems like it isn't generating the code correctly?

Re: Errors in code generation when dealing with decimal

Posted: Wed 08 Dec 2010 19:23
by KW
private decimal _Rate = 0.00; //Error here.
partial void OnGetRate(ref decimal value);
partial void OnRateChanging(ref decimal value);
partial void OnRateChanged();

///
/// There are no comments for Miscitems in the schema.
///
[EdmScalarPropertyAttribute(IsNullable=false)]
[DataMemberAttribute()]
public decimal Miscitems
{
get
{
decimal value = _Miscitems;
OnGetMiscitems(ref value);
return value;
}
set
{
if (_Miscitems != value)
{
OnMiscitemsChanging(ref value);
ReportPropertyChanging("Miscitems");
_Miscitems = StructuralObject.SetValidValue(value);
ReportPropertyChanged("Miscitems");
OnMiscitemsChanged();
}
}
}

Posted: Thu 09 Dec 2010 16:00
by AndreyR
I've tried to reproduce the error using the latest build of dotConnect for MySQL and failed.
Could you please provide the script of the table containing the decimal column?`

Posted: Thu 09 Dec 2010 17:38
by KW
AndreyR wrote:I've tried to reproduce the error using the latest build of dotConnect for MySQL and failed.
Could you please provide the script of the table containing the decimal column?`
DROP TABLE IF EXISTS `mydb`.`Example1`;
CREATE TABLE `mydb`.`Example1` (
`Rate` decimal(10,2) NOT NULL default '0.00',


Try setting the default value to 0.00. That is what is causing the issue.



I am using Entity Developer 3.0.50

Posted: Fri 10 Dec 2010 10:16
by AndreyR
Thank you for the report, we have found and fixed the problem.
The fix will be available in the nearest build.

Posted: Fri 10 Dec 2010 18:19
by KW
AndreyR wrote:Thank you for the report, we have found and fixed the problem.
The fix will be available in the nearest build.
Please report back to this post when it is updated. Thanks!

Posted: Wed 22 Dec 2010 12:11
by AndreyR
We have added the fix in the latest build.
You can download it from from Registered Users' Area or from the Downloads page (if you need a Trial edition).