public static void writeConfig() { string jsonFilepath = @"c:\temp\netcheck.json"; string databaseFilepath = SelectDatabaseFile(); string logFilepath = SelectLogFile(); if (databaseFilepath == "MISSING" || logFilepath == "MISSING") { MessageBox.Show("Error 9: Invalid file path provided."); return; } //string filepath = @"c:\temp\netcheck.json"; ConfigurationValues cv = new ConfigurationValues(); cv.TemperatureCelsius = 69; cv.DatabaseFilepath = databaseFilepath; cv.RefreshDurationinHours = 1; cv.LoggerFilepath = logFilepath; DateTime sourceTime = DateTime.Now; cv.ConfigurationDate = new DateTime(sourceTime.Year, sourceTime.Month, sourceTime.Day, sourceTime.Hour, sourceTime.Minute, 0); var options = new JsonSerializerOptions { WriteIndented = true, }; //outputs the JSON file with user friendly indentation string jsonString = JsonSerializer.Serialize(cv, options); File.WriteAllText(jsonFilepath, jsonString); JLogger.WriteGenericLogFile(System.Security.Principal.WindowsIdentity.GetCurrent().Name + "\twrote new config file"); }
public void Execute(GeneratorExecutionContext context) { if (context.SyntaxReceiver is MapToReceiver receiver) { var compilation = context.Compilation; var mapToAttributeSymbol = compilation.GetTypeByMetadataName(typeof(MapToAttribute).FullName); foreach (var candidateTypeNode in receiver.Candidates) { var model = compilation.GetSemanticModel(candidateTypeNode.SyntaxTree); var candidateTypeSymbol = model.GetDeclaredSymbol(candidateTypeNode) as ITypeSymbol; if (candidateTypeSymbol is not null) { foreach (var mappingAttribute in candidateTypeSymbol.GetAttributes().Where( _ => _.AttributeClass !.Equals(mapToAttributeSymbol, SymbolEqualityComparer.Default))) { var configurationValues = new ConfigurationValues(context, candidateTypeNode.SyntaxTree); var(diagnostics, name, text) = MapToGenerator.GenerateMapping( candidateTypeSymbol, mappingAttribute, configurationValues); foreach (var diagnostic in diagnostics) { context.ReportDiagnostic(diagnostic); } if (name is not null && text is not null) { context.AddSource(name, text); } } } } } }
public static void SaveConfigValues(ConfigurationValues cv) { var builder = new StringBuilder(); builder.AppendFormat("HOST_STANDBY_FEATURE_ENABLE {0}\r\n", cv.HostStandbyFeatureEnable); // Add the rest of your properties File.WriteAllText("values.cfg", builder.ToString()); }
public CognitiveService(IOptions <ConfigurationValues> Configuration, IComputerVisionClient visionClient, IBlobService blobService, AssetManagementSystemDBContext DbContext, IMetadataRepository metadataRepository, IImageVariantRepository imageVariantRepository, IAssetRepository assetRepository) { _Configuration = Configuration.Value; _visionClient = visionClient; _blobService = blobService; _metadataRepository = metadataRepository; _imageVariantRepository = imageVariantRepository; _assetRepository = assetRepository; }
public static ConfigurationValues readConfig() { //19/04/21 reads the configuration file with a hardcoded location string filepath = @"c:\temp\netcheck.json"; string jsonString = File.ReadAllText(filepath); ConfigurationValues cv = new ConfigurationValues(); cv = JsonSerializer.Deserialize <ConfigurationValues>(jsonString); return(cv); }
public IActionResult EditConfigurationValue(ConfigurationValues configValue) { ConfigurationValues updateConfigValue = _db.ConfigurationValues.SingleOrDefault(s => s.ConfigurationValueId == configValue.ConfigurationValueId); if (updateConfigValue != null) { updateConfigValue.Value = configValue.Value; _db.SaveChanges(); } return(RedirectToAction(nameof(Index))); }
private static (ImmutableArray <Diagnostic> diagnostics, string?name, SourceText?text) GenerateMapping( ITypeSymbol sourceType, AttributeData attributeData, ConfigurationValues configurationValues) { var information = new MappingInformation(sourceType, attributeData); if (!information.Diagnostics.Any(_ => _.Severity == DiagnosticSeverity.Error)) { var text = new MappingBuilder(information, configurationValues).Text; return(information.Diagnostics, $"{sourceType.Name}_To_{information.DestinationType.Name}_Map.g.cs", text); } return(information.Diagnostics, null, null); }
public void Test_StopwatchViewModel_HappyPath() { //arrange string initialText = ""; bool wasStopped = false; string afterTick = ""; string afterStopped = ""; string afterReset = ""; Mock <IUserInterface> ui = new Mock <IUserInterface>(); Mock <ILogger> logger = new Mock <ILogger>(); var config = new ConfigurationValues(); var timer = CreateDispatcherTimer(config); StopwatchClock clock = new StopwatchClock(logger.Object, config, timer.Object); StopwatchViewModel stopwatchvm = new StopwatchViewModel(ui.Object, clock, config, logger.Object); //act MethodInfo dynMethod = stopwatchvm.GetType().GetMethod("Ui_UiEventHappened", BindingFlags.NonPublic | BindingFlags.Instance); dynMethod.Invoke(stopwatchvm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnStartClicked) }); initialText = stopwatchvm.Text; timer.Raise(x => x.Tick += null, this, new EventArgs() { }); afterTick = stopwatchvm.Text; dynMethod.Invoke(stopwatchvm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnStartClicked) }); wasStopped = !timer.Object.IsEnabled; afterStopped = stopwatchvm.Text; dynMethod.Invoke(stopwatchvm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnResetClicked) }); afterReset = stopwatchvm.Text; stopwatchvm.Dispose(); //assert Assert.Equal("00:00:00", initialText); Assert.Equal("00:00:01", afterTick); Assert.True(wasStopped); Assert.Equal("00:00:01", afterStopped); Assert.Equal("00:00:00", afterReset); logger.Verify(x => x.LogError(It.IsAny <string>()), Times.Never); logger.Verify(x => x.LogError(It.IsAny <string>(), It.IsAny <Exception>()), Times.Never); }
private void LoadConfigValues() { try { ConfigurationValues config = new ConfigurationValues(); config.SomeConfigItem = 0; ApplicationConfiguration.Config = config; } catch (Exception ex) { this.EventLog.WriteEntry("LoadConfigValues - Exception: " + ex.ToString(), EventLogEntryType.Error); } }
public static ConfigurationValues LoadConfigValues() { var cv = new ConfigurationValues(); string[] lines = File.ReadAllLines("values.cfg"); foreach (string cfg in lines) { string[] nameValue = cfg.Split(new char[] { ' ' }); // To get label/value if (nameValue[0] == "HOT_STANDBY_FEATURE_ENABLE") { cv.HotStandbyFeatureEnable = nameValue[1]; } else if (nameValue[0] == "SOME_OTHER_PROPERTY") { cv.SomeOtherProperty = nameValue[2]; } // Continue for all properties } return(cv); }
static async Task Main(string[] args) { var configurationManager = new ConfigurationManager(args); var configuration = ConfigurationValues.GetFromConfigurationManager(configurationManager); IQueueClient queueClient = QueueClientFactory.GetQueueClientFromConnectionString(configuration.Queue.ConnectionString); KubeClient kubeClient; if (String.IsNullOrWhiteSpace(configuration.Kubernetes.KubeConfig)) { kubeClient = new KubeClient(); } else { kubeClient = new KubeClient(configuration.Kubernetes.KubeConfig); } IScalingRule scalingRule = new IncrementRule(new TimeSpan(0, 1, 0)); await CheckQueue(queueClient, kubeClient, scalingRule, configuration, configurationManager); }
public static void Create(string indentStyleValue, bool indentStyleCallbackReturn, string indentSizeValue, bool indentSizeCallbackReturn, uint expectedIndentSize, IndentStyle expectedIndentStyle) { bool IndentStyleCallback(string key, [NotNullWhen(true)] out string?value) { value = indentStyleValue; return(indentStyleCallbackReturn); } bool IndentSizeCallback(string key, [NotNullWhen(true)] out string?value) { value = indentSizeValue; return(indentSizeCallbackReturn); } var tree = SyntaxFactory.ParseSyntaxTree("var id = 3;"); var options = Rock.Create <AnalyzerConfigOptions>(); options.Methods().TryGetValue("indent_size", Arg.Any <string?>()).Callback(IndentSizeCallback); options.Methods().TryGetValue("indent_style", Arg.Any <string?>()).Callback(IndentStyleCallback); var provider = Rock.Create <AnalyzerConfigOptionsProvider>(); provider.Methods().GetOptions(tree).Returns(options.Instance()); var configuration = new ConfigurationValues(provider.Instance(), tree); Assert.Multiple(() => { Assert.That(configuration.IndentSize, Is.EqualTo(expectedIndentSize), nameof(configuration.IndentSize)); Assert.That(configuration.IndentStyle, Is.EqualTo(expectedIndentStyle), nameof(configuration.IndentSize)); }); provider.Verify(); options.Verify(); }
public static ReturnSet <ConfigurationValues> ParseConfiguration(IConfiguration configuration) { try { var config = new ConfigurationValues(); var properties = typeof(ConfigurationValues).GetProperties().ToList(); foreach (var property in properties) { var propertyValue = configuration[property.Name]; var propertyVal = Convert.ChangeType(propertyValue, property.PropertyType); property.SetValue(config, propertyVal); } return(new ReturnSet <ConfigurationValues>(config)); } catch (Exception ex) { return(new ReturnSet <ConfigurationValues>(ex, "Failed to parse configuration file")); } }
static async Task CheckQueue(IQueueClient queueClient, KubeClient kubeClient, IScalingRule scalingRule, ConfigurationValues configuration, ConfigurationManager configurationManager) { Console.WriteLine("Nanny.Checker is Running."); var queueName = configuration.Queue.QueueName; do { if (!configurationManager.GetNotRequired("NANNY_IS_ACTIVE", defaultValue: true)) { var nextCheck = 60; Console.WriteLine($"Waiting for {nextCheck} seconds, before checking queue {queueName}"); await Task.Delay(nextCheck * 1000); } var messageCount = await queueClient.GetMessageCountAsync(queueName); Console.WriteLine($"There are {messageCount} messages in the queue {queueName}"); var currentRunningJobs = await GetCurrentRunningJobs(kubeClient, configuration.Kubernetes.K8Namespace, queueName); Console.WriteLine($"I have found {messageCount} jobs in Kubernetes"); if (await kubeClient.IsResourceAvailableAsync() && currentRunningJobs < configuration.Kubernetes.ContainerLimit) { var result = scalingRule.GetJobScalingResult(messageCount, currentRunningJobs); if (result.JobCount > 0) { Console.WriteLine($"Creating {result.JobCount} jobs"); await CreateKubeJob(kubeClient, configuration.Kubernetes, queueName, result.JobCount); } Console.WriteLine($"Waiting for {result.NextCheck.TotalSeconds} seconds, before checking queue {queueName}"); await Task.Delay(result.NextCheck); } else { Console.WriteLine("No more resources available in the cluster!"); await Task.Delay(5 * 60 * 1000); } } while (true); }
private static SourceText Build(MappingInformation information, ConfigurationValues configurationValues) { using var writer = new StringWriter(); using var indentWriter = new IndentedTextWriter(writer, configurationValues.IndentStyle == IndentStyle.Tab ? "\t" : new string (' ', (int)configurationValues.IndentSize)); var usingStatements = new SortedSet <string>(); if (!information.SourceType.IsValueType) { usingStatements.Add("using System;"); } ; if (!information.DestinationType.ContainingNamespace.IsGlobalNamespace && !information.SourceType.ContainingNamespace.ToDisplayString().StartsWith( information.DestinationType.ContainingNamespace.ToDisplayString(), StringComparison.InvariantCulture)) { usingStatements.Add($"using {information.DestinationType.ContainingNamespace.ToDisplayString()};"); } foreach (var usingStatement in usingStatements) { indentWriter.WriteLine(usingStatement); } if (usingStatements.Count > 0) { indentWriter.WriteLine(); } if (!information.SourceType.ContainingNamespace.IsGlobalNamespace) { indentWriter.WriteLine($"namespace {information.SourceType.ContainingNamespace.ToDisplayString()}"); indentWriter.WriteLine("{"); indentWriter.Indent++; } indentWriter.WriteLine($"public static partial class {information.SourceType.Name}MapToExtensions"); indentWriter.WriteLine("{"); indentWriter.Indent++; indentWriter.WriteLine($"public static {information.DestinationType.Name} MapTo{information.DestinationType.Name}(this {information.SourceType.Name} self) =>"); indentWriter.Indent++; if (!information.SourceType.IsValueType) { indentWriter.WriteLine("self is null ? throw new ArgumentNullException(nameof(self)) :"); indentWriter.Indent++; } indentWriter.WriteLine($"new {information.DestinationType.Name}"); indentWriter.WriteLine("{"); indentWriter.Indent++; foreach (var map in information.Maps) { indentWriter.WriteLine(map); } indentWriter.Indent--; indentWriter.WriteLine("};"); if (!information.SourceType.IsValueType) { indentWriter.Indent--; } indentWriter.Indent--; indentWriter.Indent--; indentWriter.WriteLine("}"); if (!information.SourceType.ContainingNamespace.IsGlobalNamespace) { indentWriter.Indent--; indentWriter.WriteLine("}"); } return(SourceText.From(writer.ToString(), Encoding.UTF8)); }
private static SourceText Build(INamedTypeSymbol source, INamedTypeSymbol destination, ImmutableArray <string> propertyNames, MappingContext context, Compilation compilation, ConfigurationValues configurationValues) { using var writer = new StringWriter(); using var indentWriter = new IndentedTextWriter(writer, configurationValues.IndentStyle == IndentStyle.Tab ? "\t" : new string (' ', (int)configurationValues.IndentSize)); var namespaces = new NamespaceGatherer(); var emittedNamespace = false; if (context.ContainingNamespaceKind != ContainingNamespaceKind.Global) { if (context.ContainingNamespaceKind == ContainingNamespaceKind.Source) { if (source.ContainingNamespace.IsGlobalNamespace || !source.ContainingNamespace.Contains(destination.ContainingNamespace)) { namespaces.Add(destination.ContainingNamespace); } if (!source.ContainingNamespace.IsGlobalNamespace) { indentWriter.WriteLine($"namespace {source.ContainingNamespace.ToDisplayString()}"); indentWriter.WriteLine("{"); indentWriter.Indent++; emittedNamespace = true; } } else if (context.ContainingNamespaceKind == ContainingNamespaceKind.Destination) { if (destination.ContainingNamespace.IsGlobalNamespace || !destination.ContainingNamespace.Contains(source.ContainingNamespace)) { namespaces.Add(source.ContainingNamespace); } if (!destination.ContainingNamespace.IsGlobalNamespace) { indentWriter.WriteLine($"namespace {destination.ContainingNamespace.ToDisplayString()}"); indentWriter.WriteLine("{"); indentWriter.Indent++; emittedNamespace = true; } } } else { namespaces.Add(source.ContainingNamespace); namespaces.Add(destination.ContainingNamespace); } MappingBuilder.BuildType(source, destination, propertyNames, compilation, indentWriter, namespaces); if (emittedNamespace) { indentWriter.Indent--; indentWriter.WriteLine("}"); } var code = namespaces.Values.Count > 0 ? string.Join(Environment.NewLine, string.Join(Environment.NewLine, namespaces.Values.Select(_ => $"using {_};")), string.Empty, "#nullable enable", string.Empty, writer.ToString()) : string.Join(Environment.NewLine, "#nullable enable", string.Empty, writer.ToString()); return(SourceText.From(code, Encoding.UTF8)); }
public AuthController(IMemoryCache memoryCache, IDSContext dbContext, ConfigurationValues configuration) : base(memoryCache, dbContext, configuration) { }
/// <summary> /// Sets the connection provider /// </summary> /// <typeparam name="T">The connection provider class to use.</typeparam> /// <returns>The fluent configuration itself.</returns> public FluentStorageConfiguration ConnectionProvider <T>() where T : IConnectionProvider { ConfigurationValues.Add("connection.provider", typeof(T).FullName); return(this); }
///<summary> /// Sets the connection string per name ///</summary> ///<param name="connecctionStringName">The name of the connection string</param> ///<returns>The fluent configuration itself.</returns> public FluentStorageConfiguration ConnectionStringName(string connecctionStringName) { ConfigurationValues.Add("connection.connection_string_name", connecctionStringName); return(this); }
public void Test_TimerViewModel_HappyPath() { //arrange string startAt = "02"; string initialText = ""; string stoppedText = ""; string afterTick = ""; string finalText = ""; string afterReset = ""; Mock <IUserInterface> ui = new Mock <IUserInterface>(); Mock <ILogger> logger = new Mock <ILogger>(); Mock <ILoopSoundPlayer> player = new Mock <ILoopSoundPlayer>(); var config = new ConfigurationValues(); var timer = CreateDispatcherTimer(config); TimerClock clock = new TimerClock(config, logger.Object, timer.Object); TimerViewModel timervm = new TimerViewModel(ui.Object, player.Object, clock, config, logger.Object); //act timervm.Text = startAt; MethodInfo dynMethod = timervm.GetType().GetMethod("Ui_UiEventHappened", BindingFlags.NonPublic | BindingFlags.Instance); dynMethod.Invoke(timervm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnStartClicked) }); initialText = timervm.Text; timer.Raise(x => x.Tick += null, this, new EventArgs() { }); afterTick = timervm.Text; dynMethod.Invoke(timervm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnStartClicked) }); timer.Raise(x => x.Tick += null, this, new EventArgs() { }); stoppedText = timervm.Text; dynMethod.Invoke(timervm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnStartClicked) }); timer.Raise(x => x.Tick += null, this, new EventArgs() { }); finalText = timervm.Text; dynMethod.Invoke(timervm, new object[] { new object(), new UIEventArgs(UIEventArgs.UIEventType.BtnResetClicked) }); afterReset = timervm.Text; timervm.Dispose(); //assert Assert.Equal("00:00:02", initialText); Assert.Equal("00:00:01", afterTick); Assert.Equal("00:00:01", stoppedText); Assert.Equal("00:00:00", finalText); Assert.Equal("00:00:01", afterReset); logger.Verify(x => x.LogError(It.IsAny <string>()), Times.Never); logger.Verify(x => x.LogError(It.IsAny <string>(), It.IsAny <Exception>()), Times.Never); player.Verify(x => x.Play(It.IsAny <int>()), Times.Once); }
public MappingBuilder(INamedTypeSymbol source, INamedTypeSymbol destination, ImmutableArray <string> propertyNames, MappingContext context, Compilation compilation, ConfigurationValues configurationValues) => this.Text = MappingBuilder.Build(source, destination, propertyNames, context, compilation, configurationValues);
/// <summary> /// The proxy factory to use. This value defaults to /// <see cref="ProxyFactoryFactory"/>. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public FluentStorageConfiguration ProxiedBy <T>() where T : IProxyFactoryFactory { ConfigurationValues.Add("proxyfactory.factory_class", GetTypeName <T>()); return(this); }
/// <summary> /// Sets the connection string /// </summary> /// <param name="connectionString">The connection string to use.</param> /// <returns>The fluent configuration itself.</returns> public FluentStorageConfiguration ConnectionString(string connectionString) { ConfigurationValues.Add("connection.connection_string", connectionString); return(this); }
public MappingBuilder(ITypeSymbol source, ITypeSymbol destination, ImmutableArray <string> maps, ConfigurationValues configurationValues) => this.Text = MappingBuilder.Build(source, destination, maps, configurationValues);
///<summary> /// Sets the driver for the configuration ///</summary> ///<typeparam name="T">The driver class</typeparam> ///<returns>The fluent configuration itself</returns> public FluentStorageConfiguration Driver <T>() where T : IDriver { ConfigurationValues.Add("connection.driver_class", typeof(T).FullName); return(this); }
private async Task <ConfigurationValues> AutoDetectAsync(ConfigurationValues view) { if (!Directory.Exists(view.PrefixPath)) { if (File.Exists(view.InterpreterPath)) { view.PrefixPath = Path.GetDirectoryName(view.InterpreterPath); } else if (File.Exists(view.WindowsInterpreterPath)) { view.PrefixPath = Path.GetDirectoryName(view.WindowsInterpreterPath); } else { // Don't have enough information, so abort without changing // any settings. return(view); } while (Directory.Exists(view.PrefixPath) && !File.Exists(PathUtils.FindFile(view.PrefixPath, "site.py"))) { view.PrefixPath = Path.GetDirectoryName(view.PrefixPath); } } if (!Directory.Exists(view.PrefixPath)) { // If view.PrefixPath is not valid by this point, we can't find anything // else, so abort withou changing any settings. return(view); } if (string.IsNullOrEmpty(view.Description)) { view.Description = PathUtils.GetFileOrDirectoryName(view.PrefixPath); } if (!File.Exists(view.InterpreterPath)) { view.InterpreterPath = PathUtils.FindFile( view.PrefixPath, CPythonInterpreterFactoryConstants.ConsoleExecutable, firstCheck: new[] { "scripts" } ); } if (!File.Exists(view.WindowsInterpreterPath)) { view.WindowsInterpreterPath = PathUtils.FindFile( view.PrefixPath, CPythonInterpreterFactoryConstants.WindowsExecutable, firstCheck: new[] { "scripts" } ); } if (File.Exists(view.InterpreterPath)) { using (var output = ProcessOutput.RunHiddenAndCapture( view.InterpreterPath, "-c", "import sys; print('%s.%s' % (sys.version_info[0], sys.version_info[1]))" )) { var exitCode = await output; if (exitCode == 0) { view.VersionName = output.StandardOutputLines.FirstOrDefault() ?? view.VersionName; } } var arch = CPythonInterpreterFactoryProvider.ArchitectureFromExe(view.InterpreterPath); if (arch != InterpreterArchitecture.Unknown) { view.ArchitectureName = arch.ToString(); } } return(view); }
/// <summary> /// Sets the dialect. /// </summary> /// <typeparam name="T">The dialect type to use.</typeparam> /// <returns>The fluent configuration itself.</returns> public FluentStorageConfiguration Dialect <T>() where T : Dialect { ConfigurationValues.Add("dialect", typeof(T).FullName); return(this); }
public BaseApiController(IMemoryCache memoryCache, IDSContext dbContext, ConfigurationValues configuration) { Cache = memoryCache; DbContext = dbContext; Configuration = configuration; }
public bool TryGetOptions(string configFilePath, string connectionString, string migrationsDirectory, string connectionStringName, string environmentName, IDictionary <string, string> environmentVariables, string providerType, out MigrationOptions options) { options = null; configFilePath = ProcessConfigFilePath(configFilePath); if (configFilePath == null) { return(false); } var configuration = BuildConfiguration(configFilePath, environmentName); if (string.IsNullOrEmpty(connectionString)) { connectionStringName ??= DefaultConnectionStringConfigFileKey; connectionString = configuration.GetConnectionString(connectionStringName); } var configurationValues = new ConfigurationValues(); configuration.Bind(configurationValues); if (string.IsNullOrEmpty(migrationsDirectory)) { if (configurationValues.MigrationsDirectories != null && configurationValues.MigrationsDirectories.Length > 0) { migrationsDirectory = string.Join(",", configurationValues.MigrationsDirectories); } } if (string.IsNullOrEmpty(migrationsDirectory)) { migrationsDirectory = configurationValues.MigrationsDirectory; } providerType ??= configurationValues.Provider; if (providerType == null) { providerType = Providers.Default; _logger.LogWarning("Use default provider: {ProviderType}", providerType); } else { if (!Providers.IsProviderValid(providerType)) { _logger.LogError("Unsupported provider: {ProviderType}", providerType); return(false); } } TryOverwriteSettingsByEnvironmentVariables(environmentVariables, out var overwrittenMigrationsDirectory, out var overwrittenConnectionString); migrationsDirectory = overwrittenMigrationsDirectory ?? migrationsDirectory; connectionString = overwrittenConnectionString ?? connectionString; var hasErrors = false; var migrationsDirectories = new List <string>(); if (string.IsNullOrEmpty(migrationsDirectory)) { _logger.LogError("Migrations directory does not specified"); hasErrors = true; } else { foreach (var directory in migrationsDirectory.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)) { var localDirectory = directory; if (!Path.IsPathRooted(localDirectory)) { localDirectory = Path.Combine(Directory.GetCurrentDirectory(), localDirectory); } if (!Directory.Exists(localDirectory)) { _logger.LogError("Migrations directory {LocalDirectory} does not exist", localDirectory); hasErrors = true; } else { migrationsDirectories.Add(localDirectory); } } } var connectionStringsProcessor = _connectionStringsProcessorCollection.GetConnectionStringsProcessor(providerType); connectionString = connectionStringsProcessor.ProcessConnectionString(connectionString, environmentVariables); if (string.IsNullOrEmpty(connectionString)) { _logger.LogError("Connection string does not specified"); hasErrors = true; } if (hasErrors) { return(false); } options = new MigrationOptions { ConnectionString = connectionString, MigrationsDirectories = migrationsDirectories, ProviderType = providerType }; return(true); }
public MappingBuilder(MappingInformation information, ConfigurationValues configurationValues) => this.Text = MappingBuilder.Build(information, configurationValues);