Die Navigation 'Tags' zum Entitätstyp 'Notepad.Models.Note' wurde dem Modell nicht hinzugefügt oder ignoriert. oder entityType ignoriert.Die Navigation zum Entitätstyp wurde nicht zum Modell hinzugefügt oder ignoriert, oder Entitätstyp ignoriert
public class Note
{
public Note()
{
CreationDate = DateTime.Now;
Tags = new HashSet<Tag>();
Parts = new HashSet<Part>();
}
public int ID { get; set; }
public virtual ICollection<Tag> Tags { get; set; }
public virtual ICollection<Part> Parts { get; set; }
public DateTime? CreationDate { get; set; }
}
public class Tag
{
public Tag()
{
Notes = new HashSet<Note>();
}
public int ID { get; set; }
public string Name { get; set; }
public virtual ICollection<Note> Notes { get; set; }
}
kommt es vor, während eine Migration fügt hinzu:
dnx ef Migrationen hinzufügen DBData -c DataDbContext
Warum denken Sie, es passiert?
EDIT: DataDbContext:
public class DataDbContext : DbContext
{
public DbSet<Note> Notes { get; set; }
public DbSet<Tag> Tags { get; set; }
public DbSet<Part> Parts { get; set; }
}
Zeigen Sie den Code für 'Tag' an – dotctor
Haben Sie DbSet zu DataDbContext hinzugefügt? –
@MarcinZablocki Ich habe es auf die Frage eingefügt, können Sie sehen, ob alles korrekt ist – Piotrek