Reputation: 2585
In my project I'm using Entity Framework, I've got a problem in ExamProduced entity, to be especific in Quantify property.
In my database Quantify property is tinyint datatype, and when VS imported it, it became in byte. VS is notifying me an error that it's unknown for me.
Here are the images.
Upvotes: 0
Views: 96
Reputation: 1499800
Yes, there's no explicit conversion from XAttribute
to byte
. You'd probably be okay with:
Quantify = (byte) (int) objective.Attribute("Quantify")
The (int)
part will apply the explicit XAttribute
to int
conversion; the (byte)
part will perform a narrowing int
to byte
conversion. You may want to make this checked
so that you'll get an exception if the attribute is "500" for example.
Upvotes: 3