Reputation: 15551
I am using ServiceStack.OrmLite (version 3.8.5) and I have the following:
var report = dbCommand.Select<UploadedMediaReport>(x => x.Id == message.Id &&
(int)x.BitRate == (int)message.BitRate &&
(int)x.MediaFormat == (int)message.Format
).FirstOrDefault();
where
public class UploadedMediaReport
{
public MediaBitRate BitRate { get; }
public MediaFormat Format { get; }
..
}
For the SQL generated, the string values of the enum is used rather than the int values ie. the wrong SQL is:
select ... bitRate = 'High' and Format = 'MP4'
where it should be
select ... bitRate = 1 and Format = 3
How do I change this so that it works?
Upvotes: 2
Views: 376
Reputation: 4535
I'm not sure if what you are seeing is a bug, but a possible workaround is:
var report = dbCommand.Where<UploadedMediaReport>(
new {
Id = message.Id,
BitRate = (int)message.BitRate,
MediaFormat = (int)message.Format
}).FirstOrDefault();
Upvotes: 2