Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当在Xamarin中使用带有SQLite的类中的CreateTable时,有没有一种方法可以使该类中的表具有不同的名称?_C#_Sqlite_Xamarin_Xamarin.forms - Fatal编程技术网

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

C# 当在Xamarin中使用带有SQLite的类中的CreateTable时,有没有一种方法可以使该类中的表具有不同的名称?,c#,sqlite,xamarin,xamarin.forms,C#,Sqlite,Xamarin,Xamarin.forms,以下是我所拥有的: public class Note { [PrimaryKey, NotNull] public int NotesId { get; set; } public string Text { get; set; } } 我使用此语句创建表: db2.CreateTable<Note>(); db2.CreateTable(); 有没有一种方法可以将表命名为“Notes”而不是“Note”Sqlite Net使用类名创建表。作为一种解决

以下是我所拥有的:

public class Note
{
    [PrimaryKey, NotNull]
    public int NotesId { get; set; }
    public string Text { get; set; }
}
我使用此语句创建表:

db2.CreateTable<Note>();
db2.CreateTable();

有没有一种方法可以将表命名为“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();

好的,那么没有办法装饰Note类了?恐怕我们做不到,这取决于sqlite.net的设计。只是在这里添加了另一个稍微相关的问题:
db2.CreateTable<Notes>();