public void MenuItemCallback(string solutionFullName, bool regenerate = false, bool loadFromDatabase = false) { Entity entity; try { entity = DetectInformationOfProject(solutionFullName); EnumProvider.SetSolutionPathForEnums(Path.GetDirectoryName(solutionFullName) + "\\src"); EntityProvider.SetSolutionPathForEntities(Path.GetDirectoryName(solutionFullName) + "\\src\\" + entity.Namespace + ".Core"); DbContextProvider.SetSolutionPathForDbContexts(Path.GetDirectoryName(solutionFullName) + "\\src\\" + entity.Namespace + ".EntityFrameworkCore"); AppSettings.PowerToolsDirectoryName = "AspNetZeroRadTool"; } catch (Exception ex) { MsgBox.Exception("Couldn't load information of your ASP.NET Zero project!", ex); return; } try { if (regenerate) { using (JsonEntityForm jsonEntityForm = new JsonEntityForm(Path.GetDirectoryName(solutionFullName))) { if (jsonEntityForm.ShowDialog() != DialogResult.OK) { return; } entity = EntityLoaderFromJson.Build( File.ReadAllText(Path.GetDirectoryName(solutionFullName) + "\\AspNetZeroRadTool\\" + jsonEntityForm.SelectedFile + ".json"), entity); } } else if (loadFromDatabase) { using (DbTableSelectionForm tableSelectionForm = new DbTableSelectionForm(Path.GetDirectoryName(solutionFullName), entity)) { if (tableSelectionForm.ShowDialog() != DialogResult.OK) { return; } entity = tableSelectionForm.SelectedTable; } } } catch (Exception ex) { MsgBox.Exception("Couldn't load information of the entity!", ex); return; } try { var form = new EntityGeneratorForm(entity); try { if (MultiTenancyChecker.IsEnabled(entity)) { return; } form.AllowNoneMultiTenancy = true; } catch (Exception ex) { MsgBox.Exception("Cannot determine multi-tenancy !", ex); } form.Show(); } catch (Exception ex) { MsgBox.Exception("Encountered a fatal error!", ex); } }