[英]Updating SQL Server 2008 records w/spatial data types via Massive ORM (ExecuteNonQuery), UdtTypeName error
I'm trying to use Massive "dynamic ORM" by Rob Conery to query my DB (working GREAT so far). 我正在尝试使用Rob Conery的Massive“动态ORM”来查询我的数据库(到目前为止工作很棒)。 Ran into a problem when I added a Geography field to my tables.
当我将Geography字段添加到表格时出现问题。
Here's the error: UdtTypeName property must be set for UDT parameters
这是错误:
UdtTypeName property must be set for UDT parameters
Update (14Apr2011): The ADO method that is throwing the exception is .ExecuteNonQuery();
更新(14Apr2011):抛出异常的ADO方法是
.ExecuteNonQuery();
Here's the method from Massive.cs that throws the exception: 这是抛出异常的Massive.cs中的方法:
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;
}
The specific line that throws it is: result += cmd.ExecuteNonQuery();
抛出它的特定行是:
result += cmd.ExecuteNonQuery();
Here's the important bits of the table: 这是表格的重要部分:
It's hard to find any others out there using Massive, but I did report the error on Massive's GitHub Issues tab . 使用Massive很难找到其他人,但我确实在Massive的GitHub问题选项卡上报告了错误。 You can view the source code for Massive here .
您可以在此处查看Massive的源代码 。
I'm not sure how best to integrate this into Massive, but basically you need to do exactly what the error says: 我不确定如何最好地将其集成到Massive中,但基本上你需要完成错误所说的内容:
yourGeographyParam.UdtTypeName = "Geography";
Basically SQL Server needs you to explicitly name the UdtTypeName for the "weird" parameters: 基本上SQL Server需要您为“怪异”参数显式命名UdtTypeName:
http://devlicio.us/blogs/sergio_pereira/archive/2008/06/11/udttypename-and-net-data-types-in-sql.aspx http://devlicio.us/blogs/sergio_pereira/archive/2008/06/11/udttypename-and-net-data-types-in-sql.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.