SubSonic SimpleRepository Updates Cause Null Reference Exceptions

只愿长相守 提交于 2019-12-04 15:09:43
Tyler Brinks

I think I found the problem. In the SubSonic source there's a minor flaw in the Update routine where it queries the list of tables in the update query object for a column name. The Linq query needed to use the column's QualifiedName property, not the Name property. The query settings (which is the right hand side of the query) uses the fully qualified name.

I took the liberty of submitting an issue on SubSonic's GitHub site as well :)

For those interested, the issue is in Update.cs (in the Query folder), Line 229.

Change this...

var col= table.Columns.SingleOrDefault(
  x => x.Name.Equals(s.ColumnName, StringComparison.InvariantCultureIgnoreCase)
);

to this...

var col = table.Columns.SingleOrDefault(
  x => x.QualifiedName.Equals(
    s.ColumnName, StringComparison.InvariantCultureIgnoreCase
  )
);

Rebuild and you're good to go.

I ran into this problem as well and I was able to download the latest SubSonic source and the issue was already fixed. Just open the SubSonic.Core project and do a build and replace your project's reference to SubSonic.Core.

Download Latest Source http://github.com/subsonic/SubSonic-3.0

Boom - Repository Update works again!

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