syntax updates
This commit is contained in:
parent
283fa1abc2
commit
1e05d4576d
75 changed files with 3821 additions and 3905 deletions
|
|
@ -1,14 +1,13 @@
|
|||
namespace Insight.Server
|
||||
{
|
||||
internal static class Appsettings
|
||||
{
|
||||
internal const string AgentServerPort = "agent.server.port";
|
||||
internal const string AgentServerCertificate = "agent.server.certificate";
|
||||
internal const string AgentServerCertificatePassword = "agent.server.certificate.password";
|
||||
internal const string DispatchWebmatic = "dispatch.webmatic";
|
||||
namespace Insight.Server;
|
||||
|
||||
internal const string WebServerPort = "web.server.port";
|
||||
internal const string WebServerCertificate = "web.server.certificate";
|
||||
internal const string WebServerCertificatePassword = "web.server.certificate.password";
|
||||
}
|
||||
internal static class Appsettings
|
||||
{
|
||||
internal const string AgentServerPort = "agent.server.port";
|
||||
internal const string AgentServerCertificate = "agent.server.certificate";
|
||||
internal const string AgentServerCertificatePassword = "agent.server.certificate.password";
|
||||
internal const string DispatchWebmatic = "dispatch.webmatic";
|
||||
|
||||
internal const string WebServerPort = "web.server.port";
|
||||
internal const string WebServerCertificate = "web.server.certificate";
|
||||
internal const string WebServerCertificatePassword = "web.server.certificate.password";
|
||||
}
|
||||
|
|
@ -1,53 +1,52 @@
|
|||
using System.Threading.Tasks.Dataflow;
|
||||
|
||||
namespace Insight.Server.Extensions
|
||||
namespace Insight.Server.Extensions;
|
||||
|
||||
public static class Async
|
||||
{
|
||||
public static class Async
|
||||
public static async Task ParallelForEach<T>(
|
||||
this IAsyncEnumerable<T> source,
|
||||
Func<T, Task> body,
|
||||
int maxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
|
||||
TaskScheduler scheduler = null)
|
||||
{
|
||||
public static async Task ParallelForEach<T>(
|
||||
this IAsyncEnumerable<T> source,
|
||||
Func<T, Task> body,
|
||||
int maxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
|
||||
TaskScheduler scheduler = null)
|
||||
var options = new ExecutionDataflowBlockOptions
|
||||
{
|
||||
var options = new ExecutionDataflowBlockOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism
|
||||
};
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism
|
||||
};
|
||||
|
||||
if (scheduler != null)
|
||||
options.TaskScheduler = scheduler;
|
||||
if (scheduler != null)
|
||||
options.TaskScheduler = scheduler;
|
||||
|
||||
var block = new ActionBlock<T>(body, options);
|
||||
var block = new ActionBlock<T>(body, options);
|
||||
|
||||
await foreach (var item in source)
|
||||
block.Post(item);
|
||||
await foreach (var item in source)
|
||||
block.Post(item);
|
||||
|
||||
block.Complete();
|
||||
await block.Completion;
|
||||
}
|
||||
block.Complete();
|
||||
await block.Completion;
|
||||
}
|
||||
|
||||
public static async Task ParallelForEach<T>(
|
||||
this IEnumerable<T> source,
|
||||
Func<T, Task> body,
|
||||
int maxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
|
||||
TaskScheduler scheduler = null)
|
||||
public static async Task ParallelForEach<T>(
|
||||
this IEnumerable<T> source,
|
||||
Func<T, Task> body,
|
||||
int maxDegreeOfParallelism = DataflowBlockOptions.Unbounded,
|
||||
TaskScheduler scheduler = null)
|
||||
{
|
||||
var options = new ExecutionDataflowBlockOptions
|
||||
{
|
||||
var options = new ExecutionDataflowBlockOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism
|
||||
};
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism
|
||||
};
|
||||
|
||||
if (scheduler != null)
|
||||
options.TaskScheduler = scheduler;
|
||||
if (scheduler != null)
|
||||
options.TaskScheduler = scheduler;
|
||||
|
||||
var block = new ActionBlock<T>(body, options);
|
||||
var block = new ActionBlock<T>(body, options);
|
||||
|
||||
foreach (var item in source)
|
||||
block.Post(item);
|
||||
foreach (var item in source)
|
||||
block.Post(item);
|
||||
|
||||
block.Complete();
|
||||
await block.Completion;
|
||||
}
|
||||
block.Complete();
|
||||
await block.Completion;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Insight.Server.Extensions
|
||||
namespace Insight.Server.Extensions;
|
||||
|
||||
public static class ConfigurationExtensions
|
||||
{
|
||||
public static class ConfigurationExtensions
|
||||
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
|
||||
{
|
||||
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
|
||||
{
|
||||
configuration.Sources.Clear();
|
||||
configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
configuration.Sources.Clear();
|
||||
configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue