Can't get Dapper to handle SQL RowVersion properly

流过昼夜 提交于 2019-12-23 02:42:10

问题


I've got a rowversion column added to my database and I'm trying to get Dapper mapping to populate it properly on my object.

My object has...

public byte[] RowVersion { get; set; }

And I have included the RowVersion column in my query but when I do a Query..

conn.Query<MyObject, AnotherObject, AnAdditionalObject>(...

The MyObject that I get passed to me has a null for the RowVersion property.

If I do a Dapper Query() without any type then the dynamic I get back has the expected RowVersion on it with the correct value.

Has anyone had this working and if so what am I doing wrong?


回答1:


I was able to resolve this thanks to the mental knock from Panagiotis Kanavos. I started simplifying my query to be able to post it and realized that I had placed the RowVersion column in the incorrect place of my select statement so it was being sent to AnotherObject instead of MyObject

Thanks for that.



来源:https://stackoverflow.com/questions/48306278/cant-get-dapper-to-handle-sql-rowversion-properly

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