Entity Framework Core will not map to BigInteger

c# entity-framework-core

Question

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 type BigInteger 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?

1
5
1/25/2017 1:30:12 PM

Popular Answer

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.

3
1/25/2017 6:23:45 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow