//Tato metoda je tu z důvodu testů. v projektu s testama se sestavuje kontejner s registracema metodou compose() public override void Compose() { IocContainer = new Container(); //vytvořím do interface nový object Container a přes interface naplním Container IocContainer.Register <IInzeratDao, InzeratDao>(Reuse.Singleton); IocContainer.Register <IUzivatelDao, UzivatelDao>(Reuse.Singleton); IocContainer.Register <IInzeratService, InzeratService>(Reuse.Singleton); IocContainer.Register <IUzivatelService, UzivatelService>(Reuse.Singleton); ////Ciselniky DAL //IocContainer.Register<ICiselnikTypPozemkuDao, CiselnikTypPozemkuDao>(Reuse.Singleton); //IocContainer.Register<ICiselnikProdejNeboPronajemDao, CiselnikProdejNeboPronajemDao>(Reuse.Singleton); ////Ciselniky Service //IocContainer.Register<ICiselnikTypPozemkuService, CiselnikTypPozemkuService>(Reuse.Singleton); //IocContainer.Register<ICiselnikProdejNeboPronajemService, CiselnikProdejNeboPronajemService>(Reuse.Singleton); //logovni vyjimek IocContainer.Register <LoggingAspect>(); //IocContainer.Intercept<IPozemekService, LoggingAspect>(); IocContainer.Intercept <IInzeratService, LoggingAspect>(); IocContainer.Intercept <IUzivatelService, LoggingAspect>(); DalInitializer.Init(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); loggerFactory.AddSerilog(); appLifetime.ApplicationStopped.Register(Log.CloseAndFlush); DalInitializer.InitializeDatabase(app, Configuration, env); var identityServerAddress = Configuration.GetValue <string>(EnvironmentVariablesNames.IdentityServerHostAddress); app.UseCors("default"); app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions { Authority = identityServerAddress, RequireHttpsMetadata = false, AllowedScopes = new[] { TicketTraderScopes.ApiAdministrativeScope, TicketTraderScopes.ApiSaleScope, TicketTraderScopes.ApiInternalScope, TicketTraderClaims.TicketTraderStoreClaims }, ApiName = TicketTraderScopes.FullApiScope, }); app.UseMvc(); app.UseSwaggerUi(typeof(Startup).GetTypeInfo().Assembly, new SwaggerUiSettings()); }
// // GET: /Init/ public ActionResult Index() { DataContext context = new DataContext(); IDalInitializer initializer = new DalInitializer(); initializer.Initialize(); return Content("Success"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime) { loggerFactory.ConfigureLogging(Configuration, appLifetime, "EventDefinitions.Gateway"); DalInitializer.InitializeDatabase(app, Configuration, env); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); }
public void Compose() { var compositionRoot = new CompositionRoot.CompositionRoot(); compositionRoot.Compose(); var IocContainer = compositionRoot.IocContainer; //IocContainer.Register<IAllDaos, AllDaos>(); ConnectionStringSettings connString = ConfigurationManager.ConnectionStrings["ConnectionStringLocal"]; IocContainer.UseInstance(connString); DalInitializer.Init(); }
public void Compose() { IocContainer = new Container(); //DAO VRSTVA IocContainer.Register <IInzeratDao, InzeratDao>(); //Servisní Vrstva IocContainer.Register <IInzeratService, InzeratService>(); //logování výjimek IocContainer.Register <LoggingAspect>(); //zaregistrovani vsech sluzeb, ktere maji mit intercptor spolu s patricnym interceptorem IocContainer.Intercept <IInzeratService, LoggingAspect>(); DalInitializer.Init(); }