This code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
namespace ArticleLibrary_.NET.Models
{
public class ArticleLibraryEntitiy : DbContext
{
public DbSet<Post> Posts { get; set; }
public DbSet<Person> People { get; set; }
public DbSet<Tag> Tags { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
}
gives an error saying:
Expected class, delegate, enum, interface, or struct
in line
protected override void OnModelCreating(ModelBuilder modelBuilder)
and also it seems ModelBuilder is not recognized by VS code editor
Do I have to add any other reference?
you have to write the
OnModelCreatingfunction in the class. you write it under it. change your code to: