Can I use a List of String in a class intended for SQLite?

前端 未结 3 1734
感情败类
感情败类 2020-12-10 12:30

What limitations are there on data types used in a class that will be used by SQLite-net to represent a table? Specifically, can I use this:

public List

        
3条回答
  •  失恋的感觉
    2020-12-10 13:35

    ORMs (aka abstraction leak) will have this kind of problem. The fields in the class will correspond to columns in the table. If you use List or arrays then the ORM will either have to somehow combine those values in the list in a single column, for that it will have to choose some kind of separator and what if the separator appears inside your string value, ultimately you will slowly find your self in rabbit hole.

    I don't think SQLite-net support arrays/list. You will need to use string (and split and join it as required) or create a new table to represent the one-to-many relationship.

提交回复
热议问题