Is there any way to convert SQL Server *data* into entity framework objects for the purpose of seeding data?

I am using Entity Framework Code First and I would like to generate C# code for seeding data from data that already exists in the database. Right now, populating DropCreateDatabaseIfModelChanges.Seed() seems to be a completely manual process where the developer creates the objects and fills in the values. This is somewhat manageable if developers are the only ones that are responsible for seeding the data, but I'd imagine that this is often not the case.

In my particular case, there are non-developers that help populate the database through the use of some MVCScaffolding generated input forms. The data that they add really does fall into the "seed data" category so I want to include their newly added rows into my Seed() implementation. One could simply interpret this as a "Generate C# code INSERT script" function.

Thanks!

Answers


The best solution that I've come with for dealing with this can be seen here: http://stackoverflow.com/a/29785119/277992

It's not generating C# code, but I can rapidly seed data into a newly created database. I can update the seed data using SSMS "Edit Data" functionality and then regenerate another INSERT script.


Need Your Help

How to insert multiple rows by mysqli_multi_query()?

php mysqli

I am trying to do multiple insertions using mysqli_multi_query() and following is my code. The issue is its not executing the result . Kindly let me know what i did wrong?

“_form.erb.html” partial not working for create and update form code generation

ruby-on-rails ruby

I'm following the Getting Started with Rails tutorial with a slight modification (on the name of the models and attributes) but I found a problem using the form partials.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.