Errors in code generation when dealing with decimal

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Errors in code generation when dealing with decimal

Post by KW » Wed 08 Dec 2010 19:18

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?

KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Re: Errors in code generation when dealing with decimal

Post by KW » Wed 08 Dec 2010 19:23

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();
}
}
}

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 09 Dec 2010 16:00

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?`

KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Post by KW » Thu 09 Dec 2010 17:38

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 10 Dec 2010 10:16

Thank you for the report, we have found and fixed the problem.
The fix will be available in the nearest build.

KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Post by KW » Fri 10 Dec 2010 18:19

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!

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 22 Dec 2010 12:11

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).

Post Reply