Multi-dimensional arrays aren't supported in ServiceStack, i.e. in OrmLite or its text Serializers.
How to store multidimensional array with Ormlite in Sqlite?
-
16-06-2023 - |
Question
I'm storing an Item
in an in-memory Sqlite datastore using Ormlite's Db.Insert(item)
. The resulting array is null
. Do I need to change the way I'm storing it or the way I'm retrieving it?
public class Item
{
[AutoIncrement]
public long Id { get; set; }
public int[,] Numbers { get; set; }
}
public class Tester {
void Test() {
var item = new Item() { Numbers = new int[5,5] };
item.Numbers[1,1] = 1234;
using (var db = new ....) {
db.Insert(item);
var Id = db.LastInsertedId();
var result = db.SingleById<Item>(Id);
/*
OUTPUT:
result.Numbers == null
*/
}
}
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow