Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var kernel = ServiceBootstrapper.Create();

            kernel.Bind <IPaths>().To <UacCompliantPaths>().InSingletonScope();
            kernel.Get <ConsoleHost>().Start(args);
        }
Ejemplo n.º 2
0
        // 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();
            }
        }
Ejemplo n.º 3
0
        public static Container Configure(Container container)
        {
            CommonBootstrapper.Configure(container);
            InfrastructureBootstrapper.Configure(container);
            ServiceBootstrapper.Configure(container);

            return(container);
        }
Ejemplo n.º 4
0
        public static void Start()
        {
            IContainer container = IoC.Initialize();

            ServiceBootstrapper.Register(container);

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));
            GlobalConfiguration.Configuration.DependencyResolver = new StructureMapDependencyResolver(container);
        }
Ejemplo n.º 5
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     UnityConfig.RegisterComponents();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     ServiceBootstrapper.Bootstrap();
 }
Ejemplo n.º 6
0
        protected override void Configure()
        {
            kernel = ServiceBootstrapper.Create();
            kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope();
            kernel.Bind <IResultFactory>().To <ResultFactory>();

            SetupCustomMessageBindings();
            kernel.Get <IPersistanceManager>().Load();
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
0
        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) ;
        }
Ejemplo n.º 9
0
        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();
        }
Ejemplo n.º 11
0
        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();
        }
Ejemplo n.º 12
0
        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)
            {
                ;
            }
        }
Ejemplo n.º 13
0
        /// <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>();
        }
Ejemplo n.º 14
0
        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();
            }
        }
Ejemplo n.º 15
0
        // 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);
        }
Ejemplo n.º 16
0
 public static void Main(string[] args)
 {
     ServiceBootstrapper.Main(CalculationOperation.Multiplication, "2.0", args);
 }
 public CustomAuthorizeAttribute()
 {
     _authorizeStrategy = ServiceBootstrapper.GetInstance().Kernel.Get <IAuthorizeStrategy>();
 }
Ejemplo n.º 18
0
 public static void Main(string[] args) => ServiceBootstrapper.Main(CalculationOperation.Division, "1.0", args);
Ejemplo n.º 19
0
        public static void Main(string[] args)
        {
            var kernel = ServiceBootstrapper.Create();

            kernel.Get <ConsoleHost>().Start(args);
        }
Ejemplo n.º 20
0
 protected void Application_Start(object sender, EventArgs e)
 {
     ServiceBootstrapper serviceBootstrapper = new ServiceBootstrapper();
     serviceBootstrapper.Run();
 }
Ejemplo n.º 21
0
        // 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");
            });
        }
Ejemplo n.º 22
0
 // Entry point for the application.
 public static void Main(string[] args) => ServiceBootstrapper.Main(CalculationOperation.Substraction, "2.0", args);
Ejemplo n.º 23
0
 public TestBase()
 {
     kernel = new StandardKernel();
     ServiceBootstrapper.AddCustomBindings(kernel);
 }
Ejemplo n.º 24
0
        protected void Application_Start(object sender, EventArgs e)
        {
            ServiceBootstrapper serviceBootstrapper = new ServiceBootstrapper();

            serviceBootstrapper.Run();
        }