Mapping SqlGeography with Dapper

一个人想着一个人 提交于 2019-12-05 02:49:21
Marc Gravell

Dapper 1.32 now includes direct support for this. Your code should now simply work.

Void Ray

Dapper does not support DB Provider specific data types. In your case its GEOGRAPHY.

Dapper has no DB specific implementation details, it works across all .net ado providers including sqlite, sqlce, firebird, oracle, MySQL and SQL Server

In order to handle this param with Dapper, you would have to write your own handling for it. For an example, see this answer.

Good luck

I ran into a similar problem. I found that Dapper would map resultant fields to Microsoft.SqlServer.Types.SqlGeography just fine, but using them as parameters didn't work.

I've modified the SqlMapper.cs file to include support for this type. You can see the Gist here: https://gist.github.com/bmckenzie/4961483

Click on "Revisions" to see what I changed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!