public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React\Dockerfile", file => { file.RemoveAllLines(a => a == @$ "RUN dotnet build " "{uctx.ApplicationName}.React.csproj" " -c Release # -o /app/build"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.Entities/ApplicationConfiguration.cs", file => { file.InsertBeforeFirstLine(a => a.Contains(@"/*Exceptions*/"), @"/*Dashboard*/ [StringLengthValidator(Max = 300), FileNameValidator] public string CachedQueryFolder { get; set; } "); }); uctx.ChangeCodeFile(@"Southwind.Logic/Starter.cs", file => { file.ReplaceLine(a => a.Contains(@"DashboardLogic.Start(sb);"), @"DashboardLogic.Start(sb, GetFileTypeAlgorithm(p => p.CachedQueryFolder));"); file.WarningLevel = WarningLevel.None; file.Replace(@"PredictorLogic.Start(sb, () => ", @"PredictorLogic.Start(sb, "); }); uctx.ChangeCodeFile(@"Southwind.Terminal/SouthwindMigrations.cs", file => { file.InsertBeforeFirstLine(a => a.Contains(@"ExceptionsFolder"), @"CachedQueryFolder = localPrefix + @""cached-query"","); }); uctx.ChangeCodeFile(@"Southwind.Test.Environment/SouthwindEnvironment.cs", file => { file.InsertBeforeFirstLine(a => a.Contains(@"ExceptionsFolder"), @"CachedQueryFolder = localPrefix + @""cached-query"","); }); uctx.ChangeCodeFile(".editorconfig", file => { file.WarningLevel = WarningLevel.None; file.Replace("@csharp_style_namespace_declarations", "csharp_style_namespace_declarations"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.csproj", file => { file.RemoveAllLines(a => a.Contains("<LangVersion>")); }); }
private SessionHandler CreateSessionHandler() { SqlConnection connection; var connectionIsExternal = false; var transactionIsExternal = false; var upgradeContext = UpgradeContext.GetCurrent(Domain.UpgradeContextCookie); if (upgradeContext != null) { connection = upgradeContext.Services.Connection; connectionIsExternal = true; transactionIsExternal = true; } else if (Domain.SingleConnection != null) { connection = Domain.SingleConnection; connectionIsExternal = true; } else { connection = Handlers.StorageDriver.CreateConnection(this); } return(new SqlSessionHandler(this, connection, connectionIsExternal, transactionIsExternal)); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile($@"Southwind.React/App/polyfills.js", file => { file.RemoveAllLines( l => l.Contains("url-search-params-polyfill") ); file.ReplaceLine( l => l.Contains("es6-promise/auto"), "require('core-js/stable');" ); }); uctx.ChangeCodeFile($@"Southwind.React/package.json", file => { file.RemoveAllLines( l => l.Contains("url-search-params-polyfill") || l.Contains("es6-object-assign") || l.Contains("es6-promise") ); file.InsertAfterFirstLine( l => l.Contains("abortcontroller-polyfill"), @"""core-js"": ""3.6.5""," ); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile("*.csproj", file => { file.Replace(@"<TargetFramework>net5.0</TargetFramework>", @"<TargetFramework>net6.0</TargetFramework>"); file.UpdateNugetReference("Microsoft.Extensions.Configuration", "6.0.0"); file.UpdateNugetReference("Microsoft.Extensions.Configuration.Binder", "6.0.0"); file.UpdateNugetReference("Microsoft.Extensions.Configuration.Json", "6.0.0"); file.UpdateNugetReference("Microsoft.Extensions.Configuration.UserSecrets", "6.0.0"); file.UpdateNugetReference("Signum.TSGenerator", "6.0.0"); file.UpdateNugetReference("Selenium.WebDriver.ChromeDriver", "95.0.4638.6900"); }); uctx.ChangeCodeFile("Southwind.Terminal/Program.cs", file => { file.Replace("AddUserSecrets<Program>()", "AddUserSecrets<Program>(optional: true)\n"); }); uctx.ForeachCodeFile("*.cs", file => { file.Replace(new Regex(@"\bDate.Today\b"), "TimeZoneManager.Now"); file.Replace(new Regex(@"\bDate\b"), "DateOnly"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.csproj", file => { file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.2.2"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile("*.cs", file => { file.Replace("TimeSpanPrecisionValidator", "TimePrecisionValidator"); }); uctx.ForeachCodeFile("*.csproj", file => { file.UpdateNugetReference("Signum.MSBuildTask", "6.0.0"); file.UpdateNugetReference("Selenium.WebDriver.ChromeDriver", "96.0.4664.4500"); file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.5.2"); }); uctx.ChangeCodeFile(@"Southwind.React\Dockerfile", file => { file.Replace("aspnet:5.0.9-buster-slim", "aspnet:6.0.0-bullseye-slim"); file.Replace("sdk:5.0.400-buster-slim", "sdk:6.0.100-bullseye-slim"); }); uctx.ChangeCodeFile(@"Southwind.React\package.json", file => { file.UpdateNpmPackage("typescript", "4.5.2"); }); uctx.ChangeCodeFile(".editorconfig", file => { file.InsertAfterFirstLine(line => line.Contains("indent_size = 4"), "csharp_style_namespace_declarations = file_scoped:warning"); }); }
private static List <UpgradeHint> GetTypeRenameHints(string oldVersionSuffix, string newVersionSuffix) { var upgradeContext = UpgradeContext.Demand(); var oldTypes = upgradeContext.ExtractedDomainModel.Types; var hints = new List <UpgradeHint>(); foreach (var type in oldTypes) { var fullName = type.UnderlyingType; int lastDotIndex = fullName.LastIndexOf("."); if (lastDotIndex < 0) { lastDotIndex = 1; } var ns = fullName.Substring(0, lastDotIndex); var name = fullName.Substring(lastDotIndex + 1); if (ns.EndsWith(oldVersionSuffix)) { string newNs = ns.Substring(0, ns.Length - oldVersionSuffix.Length) + newVersionSuffix; string newFullName = newNs + "." + name; Type newType = upgradeContext.Configuration.Types.SingleOrDefault(t => t.FullName == newFullName); if (newType != null) { hints.Add(new RenameTypeHint(fullName, newType)); } } } return(hints); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React/package.json", file => { file.ReplaceLine(a => a.Contains("msal"), @"""@azure/msal-browser"": ""2.14.1"","); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React\tsconfig.json", file => { file.Replace(@"""target"": ""es5"",", @"""target"": ""ES2017"","); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React/package.json", file => { file.UpdateNpmPackage("react-widgets", "5.0.3"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile("*.cs", file => { file.Replace("TimeZoneManager", "Clock"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile($@"*.tsx", uctx.ReactDirectory, file => { file.Replace("eoc.defaultClick(", "/*TODO: fix*/ eoc.defaultClick("); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile($@"Southwind.React\Dockerfile", file => { file.Replace("build-development", "build-production"); }); uctx.ChangeCodeFile($@"Southwind.React\Views\Home\Index.cshtml", file => { file.Replace("supportIE = true", "supportIE = false"); }); uctx.ChangeCodeFile($@"Southwind.React\App\SCSS\custom.scss", file => { file.InsertAfterFirstLine(a => a.Contains(@"@import ""./_bootswatch"";"), @".btn.input-group-text{ background: $input-group-addon-bg; border: $input-border-width solid $input-group-addon-border-color }"); }); uctx.ChangeCodeFile(@$ "Southwind.React\package.json", file => { file.Replace("--mode='production'", "--mode=production"); file.Replace( @"webpack --config webpack.config.polyfills.js && webpack --config webpack.config.dll.js --mode=production", @"webpack --config webpack.config.polyfills.js --mode=production && webpack --config webpack.config.dll.js --mode=production"); });
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.Entities/ApplicationConfiguration.cs ", file => { file.InsertBeforeFirstLine(a => a.Contains("[AutoInit]"), @" [Serializable] public class TranslationConfigurationEmbedded : EmbeddedEntity { [Description(""Azure Cognitive Service API Key"")] [StringLengthValidator(Max = 300), FileNameValidator] public string? AzureCognitiveServicesAPIKey { get; set; } [Description(""Azure Cognitive Service Region"")] [StringLengthValidator(Max = 300), FileNameValidator] public string? AzureCognitiveServicesRegion { get; set; } [Description(""DeepL API Key"")] [StringLengthValidator(Max = 300), FileNameValidator] public string? DeepLAPIKey { get; set; } } "); file.InsertAfterFirstLine(a => a.Contains("public FoldersConfigurationEmbedded Folders { get; set; }"), @" public TranslationConfigurationEmbedded Translation { get; set; }"); }); uctx.ChangeCodeFile(@"Southwind.React/App/Southwind/Templates/ApplicationConfiguration.tsx", file => { file.InsertAfterLastLine(a => a.Contains("</Tab>"), @"<Tab eventKey=""translation"" title={ctx.niceName(a => a.translation)}> <RenderEntity ctx={ctx.subCtx(a => a.translation)} /> </Tab>"); }); uctx.ChangeCodeFile(@"Southwind.React/Startup.cs", file => { file.ReplaceLine(a => a.Contains("TranslationServer.Start(app, new AlreadyTranslatedTranslator"), @"TranslationServer.Start(app, new AlreadyTranslatedTranslator(), new AzureTranslator( () => Starter.Configuration.Value.Translation.AzureCognitiveServicesAPIKey, () => Starter.Configuration.Value.Translation.AzureCognitiveServicesRegion), new DeepLTranslator(() => Starter.Configuration.Value.Translation.DeepLAPIKey) );"); }); var azureKey = SafeConsole.AskString("Azure API Key?"); var deeplKey = SafeConsole.AskString("DeepL API Key?"); uctx.ChangeCodeFile(@"Southwind.Terminal\SouthwindMigrations.cs", file => { file.InsertBeforeFirstLine(a => a.Contains("Folders = new FoldersConfigurationEmbedded"), @$ "Translation = new TranslationConfigurationEmbedded {{ AzureCognitiveServicesAPIKey = " "{azureKey}" ", DeepLAPIKey = " "{deeplKey}" ", }},");
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.csproj", file => { file.UpdateNugetReference("DocumentFormat.OpenXml", "2.15.0"); file.UpdateNugetReference("Selenium.WebDriver.ChromeDriver", "97.0.4692.7100"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile($@"*.tsx, *.ts", uctx.ReactDirectory, file => { file.Replace(new Regex(@"refreshKey\s*=\s*{(?<val>(?:[^{}]|(?<Open>[{])|(?<-Open>[}]))+)}"), m => $@"deps={{[{m.Groups["val"].Value}]}}"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile("deployToAzure.ps1", file => { file.InsertAfterFirstLine(a => a.Contains("docker push"), @"az webapp restart --name southwind-webapp --resource-group southwind-resourceGroup"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.csproj", file => { file.UpdateNugetReference("Microsoft.Identity.Client", "4.40.0"); file.UpdateNugetReference("Selenium.WebDriver.ChromeDriver", "98.0.4758.8000"); }); }
private Func <Domain> CreateDomainBuilder(UpgradeContext context) { var buildingConfiguration = BuildBuilderConfiguration(context); Func <DomainBuilderConfiguration, Domain> builder = DomainBuilder.Run; return(builder.Bind(buildingConfiguration)); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile("*.ts, *.tsx", file => { file.Replace("Navigator.navigate(", "Navigator.view("); file.Replace("Navigator.isNavigable(", "Navigator.isViewable("); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile("*.tsx,*.ts", "Southwind.React", file => { file.Replace(new Regex(@"token\(\).entity\((\w+) *=> *\1"), @"token($1 => $1.entity"); file.Replace(new Regex(@"t.entity\((\w+) *=> *\1"), @"t.append($1 => $1.entity"); file.Replace(@"token().entity()", @"token(a => a.entity)"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.cspoj", file => { file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.1.4"); file.UpdateNugetReference("SciSharp.TensorFlow.Redist", "2.4.1"); file.UpdateNugetReference("Microsoft.NET.Test.Sdk", "16.9.4"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile("Southwind.Terminal/SouthwindMigrations.cs", file => { file.ReplaceLine(a => a.Contains("UserAssetsImporter.Import(bytes, preview);"), @"using (UserHolder.UserSession(AuthLogic.SystemUser!)) UserAssetsImporter.Import(bytes, preview); "); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.cs", uctx.EntitiesDirectory, file => { file.RemoveAllLines(a => a.Trim() == "[Serializable]"); file.Replace(new Regex(@"\[\s*Serializable\s*\]\s*"), ""); file.Replace(new Regex(@"Serializable\s*,\s*"), ""); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.cs", file => { file.Replace(".WithMin(", ".MinBy("); file.Replace(".WithMax(", ".MaxBy("); file.Replace(".GroupsOf(", ".Chunk("); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React\Southwind.React.csproj", file => { file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.1.4"); file.WarningLevel = WarningLevel.Warning; file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.0.3"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile("Southwind.Logic/Starter.cs", file => { file.Replace( "typeof(UserChartPartEntity),", "typeof(UserChartPartEntity), typeof(CombinedUserChartPartEntity),"); }); }
public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.csproj", file => { file.UpdateNugetReference("Microsoft.Graph", "4.5.0"); file.UpdateNugetReference("Microsoft.Graph.Auth", "1.0.0-preview.7"); file.UpdateNugetReference("Microsoft.Identity.Client", "4.36.1"); }); }