简体   繁体   中英

How to store multidimensional array with Ormlite in Sqlite?

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                                                  

            */
        }
    }

}

ServiceStack不支持多维数组,即OrmLite或其文本序列化程序中不支持。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM