Ich lerne Code zuerst mit Entity Framework. Vor dem Problem hatte ich das:Update-Datenbank funktioniert nicht nach Änderung des Modells
public class Book
{
[Key]
public int Id { get; set; }
[Required]
public string Title { get; set; }
[Display(Name = "Publication Name")]
public DateTime PublicationDate { get; set; }
[Required]
public float Edition { get; set; } // We might have a 2.5 edition. Rare but happens
public Author Author { get; set; }
}
Ich hatte auch ein paar Controller und Ansichten. Ich habe der Datenbank einen Datensatz hinzugefügt, um zu testen, ob CRUD funktioniert, und ihn dann gelöscht.
Dann habe ich [Required]
To Author Author
hinzugefügt und versucht, die Migration auszuführen, und update-database
. Und es schreit mich nur an und sagt:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "assignment1.Migrations.Addrequiredtoauthorinbookcs.resources" was correctly embedded or linked into assembly "assignment1" at compile time, or that all the satellite assemblies required are loadable and fully signed.
Irgendwelche Ideen was ich falsch gemacht habe und wie man es repariert?
Änderung an 'public virtual Author Author {get; einstellen; } 'um zyklische Referenz zu vermeiden. –
Was ist virtuell? – alex3wielki
In Entity Framework ist Virtual ein Schlüsselwort zum aktiven Lazy Loading. –