I am learning C # and for a network scan project. I want to save IP addresses as binaries on my SQL Server, as this seems to be the “optimal” solution.
But since I'm pretty new, I'm completely confused about how to talk EF6 about it.
I was thinking of using a variable type IPAddressin my code, but EF will save this as BIGINTin my database (using code first).
I think I can make it byte [] and use getter and setter to convert binary code to type IPAddress?
Or can I just say what to use BINARYwith data annotations? Should I still do the conversion manually?
Can anyone clarify this for me?
As I save a lot of IP addresses in the database, I want to save them in the best way.
Thank you so much!
source
share