Some times, sample data is important but boring to generate due to many related tables. So, in Entity Framework Code First, I think it's an elegant way to insert them in DropCreateDatabaseIfModelChanges::Seed().

But is there a way to export existing data from database back to a string as C# / VB sentences that insert poco objects?

If it works, we may use it to backup data gracefully, or save to multiple .cs by scenes, switch them as needed to better our test, etc.

DATABASE EXPORTS AS THE FOLLOWING CODE:

var students = new List<Student>
{
    new Student { FirstMidName = "Carson",   LastName = "Alexander", },
    new Student { FirstMidName = "Meredith", LastName = "Alonso",    },
    new Student { FirstMidName = "Arturo",   LastName = "Anand",     },
    // ...
};
students.ForEach(s => context.Students.Add(s));
context.SaveChanges();
Edit
Report