public static void Gerar(IAbstractDataContext dataContext) { if (dataContext == null) { throw new ArgumentNullException(nameof(dataContext)); } var types = MigrationAssembly .GetTypes(filtro: (f) => f.GetTabela() != null) .ToArray(); if (!MigracaoDatabase.IsGerarVersao(dataContext, types, out string versaoBase)) { return; } var migracao = dataContext.GetMigracao(); migracao.Clear(); types .ToList() .ForEach(type => migracao.CreateOrAlter(type)); migracao.DropForeigns(); migracao.CreateForeigns(); MigracaoDatabase.GravarVersao(dataContext, versaoBase); }