Subsonic 3 - 更新 NullReferenceException

发布于 2024-07-30 00:19:11 字数 471 浏览 4 评论 0原文

我正在使用 Subsonic v3.0.0.3 和 Linq 模板。 我正在尝试使用以下内容更新 SQL Server Express 数据库中的记录:

var db = new MyDB(Constants.Database);
db.Update<Contact>()
  .Set(d => d.FirstName == contact.FirstName)
  .Where(d => d.Id == contact.Id)
  .Execute();

执行此行时,我收到 NullReferenceException 。 堆栈跟踪如下:

   at SubSonic.Query.Update.GetCommand()
   at SubSonic.Query.Update.Execute()

有人可能能够提出问题所在吗?

I am using Subsonic v3.0.0.3 with the Linq templates. I am attempting to update a record in a SQL Server Express database with the following:

var db = new MyDB(Constants.Database);
db.Update<Contact>()
  .Set(d => d.FirstName == contact.FirstName)
  .Where(d => d.Id == contact.Id)
  .Execute();

I am receiving a NullReferenceException when this line is executed. The stack trace is as follows:

   at SubSonic.Query.Update.GetCommand()
   at SubSonic.Query.Update.Execute()

Any chance that someone may be able to suggest what the problem is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹淡然 2024-08-06 00:19:12

我做了一个简单的更新,给了我一个 NullReferenceException

FarmDB db = new FarmDB();
db.Update<UserInfo>().Set(x => x.phone == "13679178184").Where(x => x.name == "marship").Execute();

在进入代码后,我发现 Query/update.cs L186 中的行

internal Setting CreateSetting(IColumn column, bool isExpression)
{
    Setting s = new Setting
    {
        query = this,
        ColumnName = column.Name,
        ParameterName = (_provider.ParameterPrefix + "up_" + column.Name),
        IsExpression = isExpression,
        DataType = column.DataType
    };
    ...

ColumnName = column.QualifiedName 应该是 ColumnName = column.Name

纠正此问题后,更新运行良好。 希望有人可以检查一下。

I did a simple update which give me an NullReferenceException

FarmDB db = new FarmDB();
db.Update<UserInfo>().Set(x => x.phone == "13679178184").Where(x => x.name == "marship").Execute();

After step into the code, I found the line in Query/update.cs L186

internal Setting CreateSetting(IColumn column, bool isExpression)
{
    Setting s = new Setting
    {
        query = this,
        ColumnName = column.Name,
        ParameterName = (_provider.ParameterPrefix + "up_" + column.Name),
        IsExpression = isExpression,
        DataType = column.DataType
    };
    ...

The ColumnName = column.QualifiedName should be ColumnName = column.Name.

After correct this, update runs well. Hope some one can check this.

白芷 2024-08-06 00:19:12

嗯 - 我想说要确保连接字符串存在(我将在未来几周内修复缺少连接字符串的错误消息),除此之外 - 这看起来像一个问题 - 你介意在 Github 上发布吗?

Hmm - I would say to make sure the connection string is present (I'll be fixing the error message for missing connection strings in the coming weeks) other than that - this looks like an issue - would you mind posting at Github?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文