简体   繁体   中英

How to store a specific float in Entity FrameWork

I am trying to follow a guide from Google on how to store location data ( here ), but, I need to convert this to ASP.NET MVC C# and having a little trouble setting up the class.

I have just read this question , and, I think it is similar, but, I can't really understand the solution.

I was wondering if anyone can help me on how to store a [10,6] float in the an Entity Framework Code First Generated database, or, a better way of storing longitude and latitude in EF.

Can't you just use decimal instead of float ? I think the range and precision will be enough.

You can always create a decimal property for storing and a float property that will use the other one and do the conversion if you need float in the rest of your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM