我有以下代码:
try
{
using (var context = new DataContext())
{
if (!context.Database.Exists())
{
// Create the SimpleMembership database without Entity Framework migration schema
((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
}
}
WebSecurity.InitializeDatabaseConnection("xxx", "UserProfile", "UserId", "UserName", autoCreateTables: true);
var sql = System.IO.File.ReadAllText("SqlScript.sql");
context.Database.ExecuteSqlCommand(sql);
}
catch (Exception ex)
{
throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
}
有人可以解释“使用”的目的是什么吗?