SQLite.Net - 不知道 System.Collections.Generic.List 故障 - Xamarin Android

x_s*_*_xx 5 c# sqlite orm android xamarin

我现在在这个问题上搜索了几个小时,他不知道能力是非常合乎逻辑的(因为能力尚未制造),但是你们知道如何解决这个问题吗?

这是我得到的错误信息:不知道 System.Collections.Generic.List`1[pokedex.Ability]

我的课程:-能力

[Table ("Ability")]
public class Ability
{
    [PrimaryKey,AutoIncrement]
    public int Id { get; set; }

    public String name{ get; set; }

    [ManyToMany (typeof(PokemonAbility))]
    public List<Pokemon> pokemon{ get; set; }

    public Ability (String n)
    {
        name = n;
    }
}
Run Code Online (Sandbox Code Playgroud)

-口袋妖怪:

[Table ("Pokemon")]
public class Pokemon
{
    [PrimaryKey,AutoIncrement]
    public int DBId { get; set; }

    public int id { get; set; }

    public String name{ get; set; }

    public String type{ get; set; }

    public String image{ get; set; }

    public int Attack{ get; set; }

    public int speed{ get; set; }

    public int sp_atk{ get; set; }

    public int sp_def{ get; set; }

    public int defense{ get; set; }

    public string height{ get; set; }

    public String weight{ get; set; }

    public int hp{ get; set; }

    public String description{ get; set; }

    [ManyToMany (typeof(PokemonAbility))]
    public List<Ability> abilities{ get; set; }

    methods and consttuctor...


}
Run Code Online (Sandbox Code Playgroud)

宝可梦能力:

[Table ("PokemonAbility")]
public class PokemonAbility
{
    public PokemonAbility ()
    {
    }

    [ForeignKey (typeof(Pokemon))]
    public int PokemonId { get; set; }

    [ForeignKey (typeof(Ability))]
    public int AbilityId { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的数据库:

public class NormalDatabase
{

    private String pathToDatabase;

    public NormalDatabase ()
    {
        var documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
        pathToDatabase = Path.Combine (documents, "db_adonet.db");
    }

    //aanmaken van de tabel => met objecten pokemon
    public void CreateDatabase ()
    {
        using (var conn = new SQLite.SQLiteConnection (pathToDatabase)) {
            conn.DropTable<Pokemon> ();
            conn.DropTable<Ability> ();
            conn.DropTable<PokemonAbility> ();
            conn.CreateTable<Pokemon> ();  //here he fails ofc
            conn.CreateTable<Ability> ();
            conn.CreateTable<PokemonAbility> ();
        }
    other methods
    }
Run Code Online (Sandbox Code Playgroud)

提前致谢!

Kai*_*und -5

请参阅异常类型:它是NotSupportedException

请参阅此处:如何创建集合 (1:n) 关系