I want to be able to generate a table from a class object from a short-code. Is there any available extension in Microsoft Visual Studio 2017 that does that?

  • What kind of "table" are you thinking about? Can you expand on what features do you need?
    – Alejandro
    Commented Nov 4, 2021 at 15:41

1 Answer 1


It's more than a simple extension, but the Code First workflow of Entity Framework does this. Here is a tutorial on this topic.

The code contains three sample classes, e.g. Student:

public class Student
    public int ID { get; set; }
    public string LastName { get; set; }
    public string FirstMidName { get; set; }
    public DateTime EnrollmentDate { get; set; }

    public virtual ICollection<Enrollment> Enrollments { get; set; }

Later on, the tutorial mentions a database initializer:

public class SchoolInitializer : System.Data.Entity.DropCreateDatabaseIfModelChanges<SchoolContext>

which will create the database when you use the application for the first time:

When you ran the Students page and the application tried to access the database, EF discovered that there was no database and created one.

This particular database initializer is most useful when creating a database from scratch, but the are migration options to add columns or tables to existing databases. All in all, the framework is pretty powerful; it supports most things you'll be looking for in a database like foreign keys and indices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.