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?
Errors in code generation when dealing with decimal
Re: Errors in code generation when dealing with decimal
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();
}
}
}
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();
}
}
}
DROP TABLE IF EXISTS `mydb`.`Example1`;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?`
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
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).
You can download it from from Registered Users' Area or from the Downloads page (if you need a Trial edition).