在Xamarin中使用带有SQLite的类中的CreateTable时,有没有一种方法可以使该类的表具有不同的名称?

问题描述

这就是我所拥有的:

public class Note
{
    [PrimaryKey,NotNull]
    public int NotesId { get; set; }
    public string Text { get; set; }
}

我正在使用以下语句创建表:

db2.CreateTable<Note>();

有没有一种方法可以将表命名为“ Notes”而不是“ Note”

解决方法

Sqlite-Net使用类名称创建表。解决方法是,您可以创建 Note

的子类
public class Note
{
    [PrimaryKey,NotNull]
    public int NotesId { get; set; }
    public string Text { get; set; }
}

public class Notes :Note
{
}
db2.CreateTable<Notes>();