Beispiel #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options =>
            {
                //options.LoginPath = new PathString("/");
            });

            var diConf = new NinjectConfigure();

            //todo
            string dbConnection = Configuration.GetConnectionString("DefaultConnection");

            services.AddDbContext <AppDBContext, MsSqlApplicationContext>(o => o.UseSqlServer(dbConnection));
            diConf.AddTypeConfig(c => c.Bind <AppDBContext>().ToMethod(c =>
                                                                       new MsSqlApplicationContext(
                                                                           new DbContextOptionsBuilder <MsSqlApplicationContext>()
                                                                           .UseSqlServer(dbConnection)
                                                                           .Options)));

            services.AddControllersWithViews().AddRazorRuntimeCompilation();

            services.AddHttpContextAccessor();

            services.AddSignalR();

            services.AddSingleton <IUserIdProvider, UserIdPrivider>();

            services.AddScoped <ActionsBuilder>();

            services.AddTransient <HttpQueryParamsService>();

            services.AddTransient <VueModelCreatorService>();

            services.AddSingleton <VueTemplateService>();

            var appObjects = new AppObjects();

            services.AddSingleton(appObjects);
            diConf.AddTypeConfig(c => c.Bind <AppObjects>().ToConstant(appObjects));

            diConf.AddTypeConfig(c => c.Bind <DBLogger>().To <DBLogger>());

            services.AddSingleton <IKernel>(sp => new StandardKernel(diConf));
        }
 public RoomsHub(ILogger <RoomsHub> logger, AppObjects objects) : base(logger, objects)
 {
 }
Beispiel #3
0
 public BaseHub(ILogger logger, AppObjects objects)
 {
     Logger  = logger;
     Objects = objects;
 }
Beispiel #4
0
 public GameHub(ILogger <GameHub> logger, AppObjects objects, ActionsBuilder builder) : base(logger, objects)
 {
     Builder = builder;
 }
 public AppObjectsProcess(AppObjects objects)
 {
     Objects = objects;
 }