public App() { ViewModelLocator.Initialize(); IocSetup.Initialize(); InitializeComponent(); Suspending += OnSuspending; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddAutoMapperSetup(); IocSetup.RegisterServices(services, Configuration); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Run inversion of control. IocSetup.Run(services, Configuration); // Run authentication setup. AuthenticationSetup.Run(services, Configuration); // Add CORS support. CorsSetup.Run(services, Configuration); // Add http context accessor. services.AddHttpContextAccessor(); // Add app db context. AppDbContextSetup.Run(services, Configuration); //// some details omitted //services.AddIdentityServer() // .AddInMemoryApiResources(Is4Setup.LoadApiResources()) // .AddInMemoryIdentityResources(Is4Setup.LoadIdentityResources()) // .AddInMemoryClients(Is4Setup.LoadClients()) // .AddDeveloperSigningCredential(); //services.AddAuthentication() // .AddGoogle("Google", options => // { // options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme; // options.ClientId = "323676358406-ikvol20relacv3mn5popdi79e5m759pc.apps.googleusercontent.com"; // options.ClientSecret = "68pGK3guMhv_bdJKQOznblSi"; // }) // .AddOpenIdConnect("demoidsrv", "IdentityServer", options => // { // options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme; // options.SignOutScheme = IdentityServerConstants.SignoutScheme; // options.Authority = "http://localhost:57547"; // options.ClientId = "implicit"; // options.ResponseType = "id_token"; // options.SaveTokens = true; // options.CallbackPath = new PathString("/signin-idsrv"); // options.SignedOutCallbackPath = new PathString("/signout-callback-idsrv"); // options.RemoteSignOutPath = new PathString("/signout-idsrv"); // options.RequireHttpsMetadata = false; // options.TokenValidationParameters = new TokenValidationParameters // { // NameClaimType = "name", // RoleClaimType = "role" // }; // }); services .AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
public static void Initialize() { if (_isInitialized) { return; } IocSetup.Initialize(); ViewModelLocator.Initialize(); _isInitialized = true; }
static async Task Main(string[] args) { var services = new ServiceCollection(); services.AddScoped <Program>(); IocSetup.Register( services, environmentName: Environment.GetEnvironmentVariable("ENVIRONMENT_NAME"), additionalRegistrations: null); var serviceProvider = services.BuildServiceProvider(); var program = serviceProvider.GetRequiredService <Program>(); await program.RunAsync(); }
private static void Main(string[] args) { HostFactory.Run(x => { //Debugger.Launch(); //Debugger.Break(); IocSetup.Setup(); x.Service <Monitor>(s => { s.ConstructUsing(name => TinyIoCContainer.Current.Resolve <Monitor>()); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); }); x.RunAsLocalSystem(); x.SetDescription("Surveillance Monitor for alerting and reactive to alarms"); x.SetDisplayName("SurveillanceMonitor"); x.SetServiceName("SurveillanceMonitor"); x.UseSerilog(); }); }