I have a table in my database called Coordinate where every row consists of CoordinateId
, X
, and Y
as well as a foreign key of TileId
.
I know using a string as a primary key is generally considered bad practice. But I'm wondering if it could be a good idea in this case. I would make the CoordinateId
the value of X
and Y
. So x = 4 y = -3 would have the CoordinateId = "4,-3"
. Coordinates will never change, everyone is unique and no values in the table will ever change.
The reason I'm thinking about this is that it'd make it very easy to call. I'd be able to do a Village.Title.Coordinate.Id = "4,4"
to quickly find a specific CoordinateId
. Not that it would be hard to instead find Coordinate.X && Coordinate.Y
. But still, it's a bit nice to have. Otherwise, the CoordinateId
would basically be a placeholder, a value I would have no use for.
Using MVC, sqlserver and entity framework.