This is a simple documentation on how to extract the information from information_schema.columns using EF Core. I’ve tried a number of suggestions however it didn’t worked until this.
What you need
- New View – Create a new view in your database that selects from information_schema.columns
- Code Changes
AppDbContext.cs
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity(mb =>
{
mb.HasNoKey();
mb.ToView(“vInformationSchemaColumns”);
});
}
After adding the two changes, add your migration file and you would be able to map the information