Mapping geography field to a POCO field
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Some context:
- I'm coding against .NET Standard 2.0
- UDT types are not yet supported, and I'm using SQL Server.
- I want to map a geography field to a field in one of my poco's.
Current behaviour:
When trying to map a table which contains a geography field, Dapper throws the following exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Types
Which I find somewhat strange as I thought the UdtTypeHandler was not being compiled for .NET Standard 2.0. Can someone elaborate?
Goal:
I'd be perfectly content if it would be possible to create a custom typehandler for the IPoint interface in which I process the WKB. Currently this custom typehandler is not even called (although it is registered).
To wrap up, is it possible to handle geography fields as if a generic string type field?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the geography mapping against .NET Standard 2.0 and SQL Server, then inspect the UdtTypeHandler path and the registered custom handler for IPoint. Done means geography values can be mapped without the Microsoft.SqlServer.Types load failure, with the custom handler invoked or the supported limitation documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100