asp.net mvc 4 - Changing c# code from database first to Code First -
i have succesfuuly migrated application database first code first, further want automatically change code structure instead of doing manually.
for example, in database first:
test_masters tt = new test_masters(); tt.test_name = "httt"; edmx.addtotest_masters(tt); // database first syntax edmx.savechanges();
so above thing have manually change support code first syntax.
in code-first:
test_masters tt = new test_masters(); tt.test_name = "httt"; edmx.test_masters.add(tt); // code-first syntax edmx.savechanges();
is there other way automatically change above code instead of doing manually?
same applies stored procedures:
var data1 = edmx.sp_gettest("cbc").tolist(); // database first syntax var data = edmx.database.sqlquery<string>("sp_gettest @testname,@active", new sqlparameter("testname", "lisa"), new sqlparameter("active", false)).tolist(); // code-first syntax
Comments
Post a Comment