简体   繁体   中英

Can't get Dapper to handle SQL RowVersion properly

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM