Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity Framework Code First not working properly
    primarykey
    data
    text
    <p>I have this simple model</p> <pre><code>public class Autor { [Key] int AutorID { get; set; } [Required] [MaxLength(100)] public string Nome { get; set; } [Required] [Display(Name = "Data de nascimento")] [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)] public DateTime Data { get; set; } public virtual ICollection&lt;Livro&gt; Livros { get; set; } } </code></pre> <p>and</p> <pre><code>public class Livro { public int LivroID { get; set; } [Required(ErrorMessage = "E necessario titulo")] [MaxLength(100, ErrorMessage = "Titulo deve ter no maximo 100 caracteres")] public string Titulo { get; set; } [Required] [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)] public DateTime Data { get; set; } [Required] [Range(1, 5000, ErrorMessage = "Valor deve ser entre 1 e 5000")] public int Paginas { get; set; } [Required] public int AutorID { get; set; } [Required] public virtual Autor Autor { get; set; } </code></pre> <p>Usage:</p> <pre><code>public class BibliotecaContext : DbContext { public DbSet&lt;Autor&gt; Autores { get; set; } public DbSet&lt;Livro&gt; Livros { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;(); modelBuilder.Entity&lt;Autor&gt;().HasMany(p =&gt; p.Livros).WithRequired(p =&gt; p.Autor); } } </code></pre> <p>When i try to create a controller strongly typed for the Livro class I'm getting this:</p> <p><img src="https://i.stack.imgur.com/Tp70V.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload