示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
            services.AddRazorPages();

            CoreInstaller.Install(services, Configuration);
        }
示例#2
0
        public override void InstallBindings()
        {
            CoreInstaller.Install(Container);

            Container.Decorate <IGameStatusObserver>().With <GameStatusObserverDecorator>().AsSingle().NonLazy();

            Container.Bind <IInitializable>().To <MainInitializable>().AsSingle().NonLazy();
        }
示例#3
0
        public override void InstallBindings()
        {
            CoreInstaller.Install(Container);

            IGameDef gameDef = _gameDef;

            Container.Bind <IInitializable>().To <SingleGameInitializable>().AsSingle().WithArguments(gameDef).NonLazy();
        }
 public override void Setup()
 {
     base.Setup();
     CoreInstaller.Install(Container);
     Container.Bind <BuildingsData>()
     .FromResolveGetter <ISerializer>(f => f.Deserialize <BuildingsData>($"{Application.dataPath}/Files/buildings.json"))
     .AsSingle();
     Container.Inject(this);
 }
示例#5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services
            .AddMvc(options => {
                options.Filters.Add <ModelValidationFilter>();
                options.EnableEndpointRouting = false;
            })
            .AddControllersAsServices()     //获取Controllers控制权,实现属性注入
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "xCoronavirus API", Version = "v1"
                });
            });

            var installer = new CoreInstaller();

            return(installer.Install(services, "xCoronavirus"));
        }