public static void Main(string[] args) { var kernel = ServiceBootstrapper.Create(); kernel.Bind <IPaths>().To <UacCompliantPaths>().InSingletonScope(); kernel.Get <ConsoleHost>().Start(args); }
// Entry point for the application. public static void Main(string[] args) { IConfiguration config = ServiceBootstrapper.BuildConfiguration(args, ServiceBootstrapper.BuildConfigurationOptions.RandomizeUrls); IApplication app = ServiceBootstrapper.StartApplication(config); ILogger logger = app.Services.GetService <ILogger <Startup> >(); logger.LogInformation("Started the server..."); logger.LogInformation($"Now listening on: {config["server.urls"]}"); logger.LogInformation("Application started.Press Ctrl + C to shut down."); var registrator = new ServiceRegistrator(config); registrator.RegisterOperationService("1.0").ContinueWith(task => { if (task.Status == TaskStatus.RanToCompletion) { logger.LogInformation($"Service operation 1.0 registered with url {registrator.Url}"); } else { logger.LogCritical($"Failed to register service operation 1.0 with url {registrator.Url}", task.Exception); } }); using (WaitHandle handle = ServiceBootstrapper.DisposeOnInterupt(app)) { handle.WaitOne(); } }
public static Container Configure(Container container) { CommonBootstrapper.Configure(container); InfrastructureBootstrapper.Configure(container); ServiceBootstrapper.Configure(container); return(container); }
public static void Start() { IContainer container = IoC.Initialize(); ServiceBootstrapper.Register(container); DependencyResolver.SetResolver(new StructureMapDependencyResolver(container)); GlobalConfiguration.Configuration.DependencyResolver = new StructureMapDependencyResolver(container); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); UnityConfig.RegisterComponents(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ServiceBootstrapper.Bootstrap(); }
protected override void Configure() { kernel = ServiceBootstrapper.Create(); kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope(); kernel.Bind <IResultFactory>().To <ResultFactory>(); SetupCustomMessageBindings(); kernel.Get <IPersistanceManager>().Load(); }
protected override void Configure() { kernel = ServiceBootstrapper.Create(); kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope(); kernel.Bind <IResultFactory>().To <ResultFactory>(); kernel.Bind <IParser>().To <Common.CommandLine.Parser>(); SetupCustomMessageBindings(); }
static void Main(string[] args) { ServiceBootstrapper<TestShell> bootstrapper = new ServiceBootstrapper<TestShell>(); bootstrapper.Run(); System.Console.WriteLine("Hit [ENTER] to quit."); while (System.Console.ReadKey().Key != ConsoleKey.Enter) ; }
protected override void Configure() { kernel = ServiceBootstrapper.Create(); kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope(); kernel.Bind <IResultFactory>().To <ResultFactory>(); kernel.Bind <IPaths>().To <UacCompliantPaths>().InSingletonScope(); SetupCustomMessageBindings(); }
protected override void Configure() { kernel = ServiceBootstrapper.Create(); kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope(); kernel.Bind <IResultFactory>().To <ResultFactory>(); kernel.Bind <IParser>().To <Parser>(); kernel.Bind <MainShellViewModel>().ToSelf().InSingletonScope(); kernel.Bind <TrayIconViewModel>().ToSelf().InSingletonScope(); ConfigurePanels(); SetupCustomMessageBindings(); }
protected override void OnStart(string[] args) { //#if DEBUG //System.Diagnostics.Debugger.Launch(); //#endif this.asyncBootstrapper = new ServiceApp.AsyncBootstrapper(); this.OnStop(); //Me.asyncBootstrapper.OnStopped = True this.asyncBootstrapper.StartAsync(); ServiceBootstrapper.Initialize(); }
static void Main(string[] args) { ServiceBootstrapper <TestShell> bootstrapper = new ServiceBootstrapper <TestShell>(); bootstrapper.Run(); System.Console.WriteLine("Hit [ENTER] to quit."); while (System.Console.ReadKey().Key != ConsoleKey.Enter) { ; } }
/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> private static void RegisterTypes(IUnityContainer container) { // register global dependencies WebBootstrapper.SetupDependency(container); RepositoryBootstrapper.SetupDependency(container); ServiceBootstrapper.SetupDependency(container); // register owin dependencies container.RegisterType <IRoleStore <Role, int>, RoleStore <Role, int, UserRoles> >(); container.RegisterType <IUserStore <User, int>, UserStore <User, Role, int, UserLogins, UserRoles, UserClaims> >(); container.RegisterType <IAuthenticationManager>(new InjectionFactory(c => HttpContext.Current.GetOwinContext().Authentication)); // register inner app dependencies container.RegisterType <EoraUserManager>(); container.RegisterType <EoraSignInManager>(); }
public static void Main(string[] args) { IConfiguration config = ServiceBootstrapper.BuildConfiguration(args); IApplication app = ServiceBootstrapper.StartApplication(config); ILogger logger = app.Services.GetService <ILogger <Startup> >(); TaskManager.Initialize(new MyRegistry(app.Services.GetService <ILoggerFactory>())); logger.LogInformation("Started the server..."); logger.LogInformation($"Now listening on: {config["server.urls"]}"); logger.LogInformation("Application started.Press Ctrl + C to shut down."); using (WaitHandle handle = ServiceBootstrapper.DisposeOnInterupt(app)) { handle.WaitOne(); } }
// This method gets called by the runtime. Use this method to add services to the container. public virtual IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvc(); var builder = new ContainerBuilder(); builder.RegisterType <HttpJsonProxy>(); builder.RegisterType <HttpJsonProxyGeneratorInterceptor>(); var registeredTypes = new List <Type>(); DependencyBootstrapper.Scan(_assemblies, (i, t) => { builder.RegisterType(t).As(i); registeredTypes.Add(i); }); var sb = new ServiceBootstrapper(); sb.Scan(_assemblies, registeredTypes); sb.UnmatchedInterfaces.Values.ToList().ForEach(v => { v.ForEach(t => { builder.RegisterInstance(GenerateProxy(t)).As(t) //.AsImplementedInterfaces() //.InstancePerLifetimeScope() .EnableInterfaceInterceptors() .InterceptedBy(typeof(HttpJsonProxyGeneratorInterceptor)); }); }); builder.Populate(services); ApplicationContainer = builder.Build(); var sp = new AutofacServiceProvider(ApplicationContainer); return(sp); }
public static void Main(string[] args) { ServiceBootstrapper.Main(CalculationOperation.Multiplication, "2.0", args); }
public CustomAuthorizeAttribute() { _authorizeStrategy = ServiceBootstrapper.GetInstance().Kernel.Get <IAuthorizeStrategy>(); }
public static void Main(string[] args) => ServiceBootstrapper.Main(CalculationOperation.Division, "1.0", args);
public static void Main(string[] args) { var kernel = ServiceBootstrapper.Create(); kernel.Get <ConsoleHost>().Start(args); }
protected void Application_Start(object sender, EventArgs e) { ServiceBootstrapper serviceBootstrapper = new ServiceBootstrapper(); serviceBootstrapper.Run(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddHttpContextAccessor(); var connectionString = Configuration.GetConnectionString("NavidGhavami_PersonalWebsite"); PersonalInformationBootstrapper.Configure(services, connectionString); BlogManagementBootstrapper.Configure(services, connectionString); ProjectBootstrapper.Configure(services, connectionString); ServiceBootstrapper.Configure(services, connectionString); AccountManagementBootstrapper.Configure(services, connectionString); services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.Arabic)); services.AddSingleton <IPasswordHasher, PasswordHasher>(); services.AddTransient <IFileUploader, FileUploader>(); services.AddTransient <IAuthHelper, AuthHelper>(); services.Configure <CookiePolicyOptions>(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.Lax; }); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, o => { o.LoginPath = new PathString("/Account"); o.LogoutPath = new PathString("/Account"); o.AccessDeniedPath = new PathString("/AccessDenied"); }); services.AddAuthorization(options => { options.AddPolicy("AdminArea", builder => builder.RequireRole(new List <string> { Roles.Administrator, Roles.ContentUploader })); options.AddPolicy("PersonalInformation", builder => builder.RequireRole(new List <string> { Roles.Administrator })); options.AddPolicy("Projects", builder => builder.RequireRole(new List <string> { Roles.Administrator })); options.AddPolicy("Services", builder => builder.RequireRole(new List <string> { Roles.Administrator })); options.AddPolicy("Account", builder => builder.RequireRole(new List <string> { Roles.Administrator })); }); services.AddRazorPages() .AddRazorPagesOptions(options => { options.Conventions.AuthorizeAreaFolder("Administration", "/", "AdminArea"); options.Conventions.AuthorizeAreaFolder("Administration", "/Accounts", "Account"); options.Conventions.AuthorizeAreaFolder("Administration", "/PersonalInformation", "PersonalInformation"); options.Conventions.AuthorizeAreaFolder("Administration", "/Projects", "Projects"); options.Conventions.AuthorizeAreaFolder("Administration", "/Services", "Services"); }); }
// Entry point for the application. public static void Main(string[] args) => ServiceBootstrapper.Main(CalculationOperation.Substraction, "2.0", args);
public TestBase() { kernel = new StandardKernel(); ServiceBootstrapper.AddCustomBindings(kernel); }