c# - Using a POCO in MongoDB and Entity framework with spatial indexes -
there couple classes in external library have coordinate property needs stores in mongodb , in sql server, ideally spatial indexes, without having modify class.
mongodb has no problem creating geospatial spherical index on coordinate property following code:
var collection = _database.getcollection<someclass>("somecollection") collection.createindex(indexkeys<someclass>.geospatialspherical(x => x.coordinate));
according documentation create geojson point under covers. can query object such:
var point = geojson.point(geojson.geographic(coordinate.longitude, coordinate.latitude)); var geoclause = query<someclass>.near(x => x.coordinate, point, distance); return collection.asqueryable().where(x => geoclause.inject())
with sql server , ef, however, dbgeography property needed spacial index.
what nice if there's extension point mappings object sql data type in ef, google search returned nothing of like. such thing exist?
i thought generic wrapper class, ef doesn't support generics that's not option either, , don't want create wrapper every class.
is option extend classes?
Comments
Post a Comment