/// <summary> /// The main method /// </summary> /// <param name="args">Command line arguments. These arguments are expected to be created by <see cref="IChildProcessManager.RunChildProcessAsync{TOutput}"/>.</param> /// <returns>Exit code</returns> public static int Main(string[] args) { IExtendedTracer tracer = null; try { // Inject dependencies container = DependenciesInjector.GetContainer() .InjectAnalysisDependencies(withChildProcessRunner: false) .WithChildProcessRegistrations(args); // Trace tracer = container.Resolve <IExtendedTracer>(); tracer.TraceInformation($"Starting Smart Detector runner process, process ID {Process.GetCurrentProcess().Id}"); // Run the analysis IChildProcessManager childProcessManager = container.Resolve <IChildProcessManager>(); return(childProcessManager.RunAndListenToParentAsync <SmartDetectorExecutionRequest, List <ContractsAlert> >(args, RunSmartDetectorAsync, ConvertExceptionToExitCode).GetAwaiter().GetResult()); } catch (Exception e) { tracer?.ReportException(e); tracer?.TraceError("Unhandled exception in child process: " + e.Message); Console.Error.WriteLine(e.ToString()); return(-1); } }
public InjectableObject() { if ((!IsDesignMode()) && InjectProperties) { DependenciesInjector.Inject(this, App.Current.Lake); } }
/// <summary> /// The main method /// </summary> /// <param name="args">Command line arguments. These arguments are expected to be created by <see cref="IChildProcessManager.RunChildProcessAsync{TOutput}"/>.</param> /// <returns>Exit code</returns> public static int Main(string[] args) { ITracer tracer = null; try { // Inject dependencies container = DependenciesInjector.GetContainer() .InjectAnalysisDependencies(withChildProcessRunner: false) .WithChildProcessTracer(args); // Trace tracer = container.Resolve <ITracer>(); tracer.TraceInformation($"Starting signal runner process, process ID {Process.GetCurrentProcess().Id}"); // Run the analysis IChildProcessManager childProcessManager = container.Resolve <IChildProcessManager>(); childProcessManager.RunAndListenToParentAsync <SmartSignalRequest, List <SmartSignalResultItemPresentation> >(args, RunSignalAsync).Wait(); return(0); } catch (Exception e) { tracer?.TraceError("Unhandled exception in child process: " + e.Message); Console.Error.WriteLine(e.ToString()); return(-1); } }
/// <summary> /// Initializes static members of the <see cref="Analyze"/> class. /// </summary> static Analyze() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); Container = DependenciesInjector.GetContainer() .InjectAnalysisDependencies(withChildProcessRunner: true); }
/// <summary> /// Initializes static members of the <see cref="SmartDetector"/> class. /// </summary> static SmartDetector() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); Container = DependenciesInjector.GetContainer() .RegisterType <ISmartDetectorApi, SmartDetectorApi>(); }
/// <summary> /// Initializes static members of the <see cref="Resource"/> class. /// </summary> static Resource() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); Container = DependenciesInjector.GetContainer() .RegisterType <IAuthorizationManagementClient, AuthorizationManagementClient>() .RegisterType <IAzureResourceManagerClient, AzureResourceManagerClient>(); }
static SmartDetector() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); // Force use the most updated TLS protocol SecurityProtocol.RemoveUnsecureProtocols(); Container = DependenciesInjector.GetContainer() .RegisterType <ISmartDetectorApi, SmartDetectorApi>(); }
/// <summary> /// Initializes static members of the <see cref="SignalResult"/> class. /// </summary> static SignalResult() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); Container = DependenciesInjector.GetContainer() .RegisterType <IAuthorizationManagementClient, AuthorizationManagementClient>() .RegisterType <ICloudStorageProviderFactory, CloudStorageProviderFactory>() .RegisterType <IApplicationInsightsClientFactory, ApplicationInsightsClientFactory>() .RegisterType <ISignalResultApi, SignalResultApi>(); }
static CheckResolution() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); // Force use the most updated TLS protocol SecurityProtocol.RemoveUnsecureProtocols(); Container = DependenciesInjector.GetContainer() .InjectAnalysisDependencies(withChildProcessRunner: true); }
/// <summary> /// Initializes static members of the <see cref="Schedule"/> class. /// </summary> static Schedule() { // To increase Azure calls performance we increase default connection limit (default is 2) and ThreadPool minimum threads to allow more open connections System.Net.ServicePointManager.DefaultConnectionLimit = 100; ThreadPool.SetMinThreads(100, 100); Container = DependenciesInjector.GetContainer() .RegisterType <IAlertRuleStore, AlertRuleStore>() .RegisterType <ISignalRunsTracker, SignalRunsTracker>() .RegisterType <IAnalysisExecuter, AnalysisExecuter>() .RegisterType <ISmartSignalResultPublisher, SmartSignalResultPublisher>() .RegisterType <IEmailSender, EmailSender>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); DependenciesInjector.RegisterDependencies(services, Configuration); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Alpha.Web.API", Version = "v1" }); }); }
public static void InjectPropertyTo(this ILake lake, object instance) { DependenciesInjector.Inject(instance, lake); }
public static void InjectPropertyTo(this IEnumerable <ILake> sources, object instance) { DependenciesInjector.Inject(instance, sources.ToArray()); }
public void Initialize() { dependencyManager = new ConcreteInjector(); }