I am creating desktop application using Sqlite database and entity framework. For primary keys I have taken column as BLOB, I now want to store GUID as values in this column but as a text not as BLOB.
I have found a solution that if we set "BinaryGuid=False" in Sqlite connection string it automatically save data as GUID not as blob. Now I want to implement this with entity framework. Is it possible to do this with entity framework.
Here is my working ADO .net Code:
string cs = @"Data Source=MyDatabase.db;BinaryGuid=False";
var con = new SQLiteConnection(cs);
con.Open();
var cmd = new SQLiteCommand(con);
cmd.CommandText = @"INSERT INTO MyTableName (Name,IsActive,IsDeleted,CreationTime,Id) VALUES (@Name,@IsActive,@IsDeleted,@CreationTime,@Id)";
Guid _guid = Guid.NewGuid();
cmd.Parameters.AddWithValue("@Name", "Guid False Test");
cmd.Parameters.AddWithValue("@Id", _guid);
cmd.ExecuteNonQuery();