Examples of spatial types and linq2db
See original GitHub issueI’ve spend quite some time trying to figure out how to use linq2db in combination with sql server spatial types. I’m in the need of an example how to achieve this. I’ve just upgraded from an old version of linq2db (1.0.6)
POCO:
[Table(Name = "[MyTable]")]
public class MyTable
{
// other properties
[Column(Name ="HomeLocation"), Nullable]
public SqlGeography HomeLocation { get; set; }
}
Fetching data:
using (var db = new MyDatabase())
{
var query = from o in db.MyClasses
select o;
return query.ToList();
}
Generated query seems allright!
-- MyDatabaseContext SqlServer.2012
SELECT
-- other properties are ok
[o].[HomeLocation]
FROM
[MyTable] [o]
Exception is thrown:
Can't create 'MyDatabase.sys.geography' type or '' specific type for HomeLocation.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (13 by maintainers)
Top Results From Across the Web
General | Linq To DB
Spatial types for SQL Server provided by: ... Linq To DB will automatically locate required types. You can register types assembly in Linq...
Read more >linq to sql - Spatial data types support in Linq2Sql or EF4
Here's a workaround to get it working in Entity Framework / LINQ to Entities: You can use a database View to return Well-Known-Text...
Read more >Spatial - Code First - EF6
This video shows how to map spatial types with Entity Framework Code First. It also demonstrates how to use a LINQ query to...
Read more >Spatial Data Type in Entity Framework
MS SQL Server 2008 introduced two spatial data types, geography and geometry . The geography type represents data in a round-earth coordinate system...
Read more >Entity Framework Core 3.1: Spatial Queries – Nearby Places
Spatial data is the data about the location of places. In our case, we are interested in the location of places on our...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Glad to hear! I will reopen it as we still need to update documentation on our side
Resolved by https://linq2db.github.io/articles/FAQ.html#how-can-i-use-sql-server-spatial-types Also #1843 will add xml-doc comments with that link