0
eggersa created
To allow for spatial search with MS SQL, Entity Framework provides the namespace System.Data.Entity.Spatial that includes the type DbGeography. This property enables me to easily do spatial searches with Entity Framework like so:
var university = (from u in context.Universities
orderby u.Location.Distance(myLocation)
select u).FirstOrDefault();
However, this feature is heavily database related and depends on the Entity Framework which in turn would mean that the Domain Model depends on the OR-Mapper which is kinda ugly. Is there a recommended approach to somehow use this feature without my Domain Model being dependent on the actual OR-Mapper?
1 Answer(s)
-
0
Hi,
You can create a complex type to keep same data as DbGeography, but in that case you need to replace the functionality as well, like Distance method in your example. I think that will be much harder.