我正在使用MonoDroid將數據層從我的Window Mobile應用程序移植到Android和iOS。 我的數據層在SQL SERVER,SQL CE和Windows SQLite上運行並經過了很好的測試。SQLite沒有在MonoDroid和MonoTouch上正確存儲GUID值
我在我的Android解決方案中爲我的項目創建了類庫,並導入了我的所有代碼。 我創建了一個新的DbEngine實現來調整單聲道SQLite的查詢。
當我通過像插入到[user]值('xx','hello',null)'這樣的文本插入到表中時,它工作正常,並且我可以看到受影響的行數大於0. 但是,當我嘗試插入使用命令和參數,我得到不正確的值在GUID列請參閱截圖。
// Creating the parameter
public override DbParameter CreateParameter(string name, object value)
{
DbParameter result;
if (value is byte[])
{
var length = (value as Array).Length;
result = new SqliteParameter(name, DbType.Binary, length) { Value = value};
}
else if (value is string && ((string)value).Length > 4000)
{
var length = ((string)value).Length;
result = new SqliteParameter(name, DbType.String, length) { Value = value };
}
else if (value is Guid)
{
result = new SqliteParameter(name, DbType.Guid) { Value = value }; // up to here, I can see that the GUID has the right value and the SQLiteParameter is created properly.
}
else
{
result = new SqliteParameter(name, value);
}
return result;
}
這是作爲參數