a
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
@ -9,6 +10,7 @@ public class AppSettings
|
||||
|
||||
public string? Company { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public string[]? Places { get; set; }
|
||||
public string? WorkingDirectoryName { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
@ -22,10 +24,13 @@ public class AppSettings
|
||||
Models.AppSettings result;
|
||||
if (appSettings?.Company is null) throw new NullReferenceException(nameof(appSettings.Company));
|
||||
if (appSettings?.MaxDegreeOfParallelism is null) throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||
// if (appSettings?.Places is null) throw new NullReferenceException(nameof(appSettings.Places));
|
||||
if (appSettings?.WorkingDirectoryName is null) throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
|
||||
ReadOnlyCollection<Models.Place> places = Place.GetPlaces(appSettings.Places);
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
places,
|
||||
appSettings.WorkingDirectoryName
|
||||
);
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user