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>();