I have the following code:
var sql = System.IO.File.ReadAllText(\"data_tables.sql\");
context.Database.ExecuteSqlCommand(sql);
My data_tables.s
You can use EntityFramework.Extended
to achieve this using the .Future
queries.
// build up queries
var q1 = db.Users
.Where(t => t.EmailAddress == "one@test.com")
.Future();
var q2 = db.Tasks
.Where(t => t.Summary == "Test")
.Future();
// this triggers the loading of all the future queries
var users = q1.ToList();
Entity Framework exists to make it easier for you to get data from your database to your UI and back, as well as query data using LINQ or extension methods. If your list of SQL statements has something to do with this, then it might be advantageous to do some sort of conversion. If however you're just executing a "dry" list of preprepared SQL statements, then I see no problem with your current setup.
This has a lot to do with what you're trying to do and it's very hard to suggest a strategy without more information.