title: OnModelCreating Entity Framework Core
body: <p>This code is in <code>MVC</code>, I need to do something like this but in <code>ASP.net Core</code>, using <code>Entity Framework Core</code>, or with <code>DataAnnotations</code> (I've changed the parameter already from <code>DbModelBuilder(MVC Entity Framework)</code> to <code>ModelBuilder(Entity Framework Core)</code>)</p>
  
  <pre><code> protected override void OnModelCreating(ModelBuilder modelBuilder)
          {
              modelBuilder.Conventions.Remove&lt;OneToManyCascadeDeleteConvention&gt;(); //error: Conventions is not recognized
              base.OnModelCreating(modelBuilder);
              modelBuilder.Entity&lt;tbl_Line&gt;()
                  .HasMany(d =&gt; d.tbl_Policy)
                  .WithRequired(c =&gt; c.tbl_Line) //error WithRequired not recognized
                  .HasForeignKey(c =&gt; c.int_lineID);
          }
  </code></pre>
  
  <p>There are some errors when I'm trying to use it in <code>Entity Framework Core</code>: </p>
  
  <p>1-<code>'ModelBuilder' does not contain a definition for 'Conventions' and no extension method 'Conventions' accepting a first argument of type 'ModelBuilder' could be found (are you missing a using directive or an assembly reference?)</code></p>
  
  <p>2-<code>'CollectionNavigationBuilder&lt;tbl_Line, tbl_Policy&gt;' does not contain a definition for 'WithRequired' and no extension method 'WithRequired' accepting a first argument of type 'CollectionNavigationBuilder&lt;tbl_Line, tbl_Policy&gt;' could be found (are you missing a using directive or an assembly reference?)</code> </p>