问题描述
我试图使用大规模动态ORM的罗布科纳查询我的DB(伟大的工作,到目前为止)。 。遇到了一个问题,当我添加了一个地理领域我的表
I'm trying to use Massive "dynamic ORM" by Rob Conery to query my DB (working GREAT so far). Ran into a problem when I added a Geography field to my tables.
这里的错误:
UdtTypeName属性必须为UDT参数进行设置
更新(14Apr2011):即抛出异常的ADO方法为 .ExecuteNonQuery();
下面是Massive.cs抛出异常的方法:
Update (14Apr2011): The ADO method that is throwing the exception is .ExecuteNonQuery();
Here's the method from Massive.cs that throws the exception:
public virtual int Execute(IEnumerable<DbCommand> commands) {
var result = 0;
using (var conn = OpenConnection()) {
using (var tx = conn.BeginTransaction()) {
foreach (var cmd in commands) {
cmd.Connection = conn;
cmd.Transaction = tx;
result += cmd.ExecuteNonQuery();
}
tx.Commit();
}
}
return result;
}
这将引发它的具体线路:结果+ = cmd.ExecuteNonQuery();
The specific line that throws it is: result += cmd.ExecuteNonQuery();
这里的表的重要位:
- PlaceId - BIGINT PK
- 名称 - 为nvarchar
- GeoLocation中(地理类型 - 作为一个点)
- ...
- PlaceId - bigint PK
- Name - nvarchar
- GeoLocation (Geography type - as a Point)
- ...
这是很难找到任何人有使用声势浩大,但我确实在报告错误。您可以查看。
It's hard to find any others out there using Massive, but I did report the error on Massive's GitHub Issues tab. You can view the source code for Massive here.
推荐答案
我不知道如何以最佳方式这个集成到大规模,但基本上你需要做的完全错误这样说:
I'm not sure how best to integrate this into Massive, but basically you need to do exactly what the error says:
yourGeographyParam.UdtTypeName = "Geography";
基本上SQL Server需要你明确地命名UdtTypeName为怪异的参数:
Basically SQL Server needs you to explicitly name the UdtTypeName for the "weird" parameters:
的
这篇关于更新SQL Server 2008中记录W¯¯通过大规模的ORM(的ExecuteNonQuery)/空间数据类型,UdtTypeName错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!