public IEnumerable <IActivator> Bootstrap(IPackageLog log)
        {
            _services = _inner.Bootstrap(log).Select(x => new BottleService(x, log));
            _services.Each(x => x.Start());

            return(new IActivator[0]);
        }
Beispiel #2
0
 /// <summary>
 /// Bootstraps the given bootstrapper using DependencyContainer.Current
 /// </summary>
 /// <param name="bootstrapper"></param>
 /// <returns></returns>
 public Bootstrapper Bootstrap(IBootstrapper bootstrapper)
 {
     bootstrapper.Bootstrap(DependencyContainer.Current);
     return this;
 }
 /// <summary>
 /// Bootstraps the given bootstrapper using DependencyContainer.Current
 /// </summary>
 /// <param name="bootstrapper"></param>
 /// <returns></returns>
 public Bootstrapper Bootstrap(IBootstrapper bootstrapper)
 {
     bootstrapper.Bootstrap(DependencyContainer.Current);
     return(this);
 }
Beispiel #4
0
        public void ConfigureServices(IServiceCollection services)
        {
            try {
                //configure identity for user authentication
                services.AddEntityFramework()
                        .AddSqlServer()
                        .AddDbContext<UserDBContext>(options => options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
                //First steps on the way of Code First approach and indentity integration (to be reworked/integrated shortly)

                services.AddIdentity<BookshelfUser, IdentityRole>(
                    options =>
                    {
                        options.Cookies.ApplicationCookieAuthenticationScheme = "ApplicationCookie";
                        options.Cookies.ApplicationCookie.AuthenticationScheme = Microsoft.AspNet.Identity.IdentityCookieOptions.ApplicationCookieAuthenticationType = "ApplicationCookie";
                        //TODO: rewrite in order to enable proper usage of app cookies (not clear what is this used for)
                        //options.Cookies.ApplicationCookie.DataProtectionProvider = new DataProtectionProvider(new DirectoryInfo("g:\\Workbench\\github\\Identity\\artifacts"));
                        options.Cookies.ApplicationCookie.CookieName = "Interop";
                    })
                        .AddEntityFrameworkStores<UserDBContext>()
                        .AddDefaultTokenProviders();

                //allow MVC usage for application
                services.AddMvc();
                //add in-memory caching in order to use IMemoryCache
                services.AddCaching();
                //get session timeout span
                var sessionTimeoutInterval = ConfigureSessionTimeout();
                //bootstrap services based on configuration
                var bootstrapperFactory = new BootstrapperFactory(Logger,services, Configuration["IsDIContextMocked"], sessionTimeoutInterval);
                _bootstrapper = bootstrapperFactory.Create();
                //after all the necessary configuration is done - bootstrap dependencies
                _bootstrapper.Bootstrap();
            }
            catch(Exception exc) {
                throw new Exception("Server start-up failed on dependencies initialization", exc);
            }
        }