3

I'm using simple poco class with dapper orm. Now I want to move further from testing to data persistance using sqlite db. My poco class has property Id of type Guid.

I've read somewhere that guid type is not native datatype in sqlite and it should be stored as blob or text data type. Is this true? If this is the case and I should store guid value as text inside database how can intercept value in poco class to know if it's text value than parse to guid so it can be used as public Guid Id { get; set; }

hope it's not too confusing.

Please ask if you need more info.

update: I tried with using TEXT instead of Guid as db datatype but unhandled data exception occur!

Error parsing column 0 (Id=54f039c2-03ad-4131-9b76-0cefb753cddf - String)

on query statement

var books = cnn.Query<Book>("SELECT * FROM Book").AsEnumerable();
4

0 回答 0