public static void SetupDatabase(Entry plugin) { #if ENTITY_FRAMEWORK_6 Storage.IsAvailable = OTA.Data.EF6.OTAContext.HasConnection; if (Storage.IsAvailable) ProgramLog.Admin.Log("Entity framework has a registered connection."); else ProgramLog.Admin.Log("Entity framework has no registered connection."); //if (Storage.IsAvailable) // using (var ctx = new TContext()) // { // ctx.APIAccounts.Add(new TDSM.Core.Data.Models.APIAccount() // { // Username = "******", // Password = "******" // }); // ctx.SaveChanges(); // } //#elif ENTITY_FRAMEWORK_7 //using (var ctx = new TContext()) //{ // ctx.Database.EnsureCreated(); // Storage.IsAvailable = true; //} #endif }
internal static void Initialise(Entry plugin) { plugin.Hook(HookPoints.PluginDisposed, OnDisposed); plugin.Hook(HookPoints.PluginReplacing, OnPluginReplacing); plugin.Hook(HookPoints.PluginPauseComplete, OnPluginPauseComplete); plugin.Hook(HookPoints.PluginPausing, OnPluginPausing); }