public static void Delete() { using (YomContainer container = new YomContainer()) { container.Database.Delete(); } }
public static void Create() { using (YomContainer container = new YomContainer()) { container.Database.Create(); } string connectionstring = ConfigurationManager.ConnectionStrings["YomContainer"].ConnectionString; EntityConnectionStringBuilder builder = new EntityConnectionStringBuilder(connectionstring); string providerconnectionstring = builder.ProviderConnectionString; Process process = new Process(); process.StartInfo.FileName = @"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe"; process.StartInfo.Arguments = string.Format("-A mr -C \"{0}\"", providerconnectionstring); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); Console.WriteLine(process.StandardOutput.ReadToEnd()); Console.ReadKey(); }