I'm using dapper to query data from table and then cast it to an object. When it is cast to the object the guid property is set to all zero's, but all the other props are set correct.
public class UserStuff
{
public int Id { get; set; }
public Guid UId { get; set; }
}
public async Task<UserStuff> GetUserStuff(Guid uId){
using(IDbConnection conn = Connection){
string sQuery = "SELECT TOP 100 id, u_id " +
"FROM TestTable WHERE u_id = @u_id ";
conn.Open();
var result = await conn.QueryAsync<UserStuff>(sQuery, new { u_id = uId });
return result.FirstOrDefault();
}
}
Example SQL data:
id | u_id
5 | C9DB345B-D460-4D71-87E0-D9A3B5CE1177
It's returning : 5 for the id, and all zero's for the guid