c# - Create table using Entity Framework -


i have task. task allow user create table in database. user inputs columns names , types, not know how many columns in our table. problem is: must use entity framework. can using entity framework? or not possible?

probably isn't best approach, can send database query containing create table definition.

for example:

public class context : dbcontext {  }  class program {     static void main(string[] args)     {         var mytabledefinition = "create table test(columnteste integer primary key)";         using (var context = new context())         {             context.database.createifnotexists();             context.database.executesqlcommand(mytabledefinition);         }     } } 

final result:

enter image description here


Comments