I am needing to use the BigInteger
class to handle large integers to my classes, however when trying to use EntityFramework Core to map to a DB table I recieve the following error:
The property
AllianceRank.Reputation
could not be mapped, because it is of typeBigInteger
which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it.
[Column("reputation")]
public BigInteger Reputation { get; set; }
It would seem that BigIntegers
are not a supported type for mapping. How can I force it to map, or otherwise resolve this issue?
Entity Framework would have to make assumptions about how to store that. If you're using SQL server, for example, bigint
doesn't work because your values could be larger or smaller than what's possible with bigint
. Would varchar
be more appropriate? Possibly, but if you truly mean it to be a number and not say, an identifier, asking EF to query that as a number is going to be problematic. So essentially, there are less ambiguous types like long
or string
where you're not leaving the guesswork on how to store it up to Entity Framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With