static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AutoMapperConfiguration.Initialize(); WindsorConfiguration.Register(); DataBase.InitDataBase(); Provider.InitSQLProvider(); var container = WindsorConfiguration.Container; var form = container.Resolve <IForm>(); if (User.Login()) { Application.Run((Form)form); } else { MessageBox.Show("У вас недостаточно прав для работы с программой", "Доступ заблокирован", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void When_component_is_not_registered_it_should_not_be_retrievable() { var configuration = new WindsorConfiguration(new WindsorContainer()); IReplicant component; var success = configuration.TryGet(out component); success.Should().BeFalse(); component.Should().BeNull(); }
public void When_component_is_registered_it_should_be_retrievable() { var container = new WindsorContainer(); container.Register(Component.For<IReplicant>().ImplementedBy<Nexus6>()); var configuration = new WindsorConfiguration(container); IReplicant component; var success = configuration.TryGet(out component); success.Should().BeTrue(); component.Should().NotBeNull(); component.Should().BeOfType<Nexus6>(); }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddDbContext <BloggingContext>(options => options.UseSqlServer(Configuration.GetConnectionString("BloggingDatabase"))); services.AddIdentity <User, IdentityRole <int> >() .AddEntityFrameworkStores <BloggingContext>() .AddDefaultTokenProviders(); //services.AddTransient<IEmailSender, EmailSender>(); services.AddMvc(); return(WindsorConfiguration.Configure(services)); }
public void When_component_is_registered_it_should_be_retrievable() { var container = new WindsorContainer(); container.Register(Component.For <IReplicant>().ImplementedBy <Nexus6>()); var configuration = new WindsorConfiguration(container); IReplicant component; var success = configuration.TryGet(out component); success.Should().BeTrue(); component.Should().NotBeNull(); component.Should().BeOfType <Nexus6>(); }
private static void ConfigureNcqrsEnvironment(InMemoryBufferedBrowsableElementStore buffer) { var eventStoreConnectionString = ConfigurationManager.ConnectionStrings["MyNotes Event Store"].ConnectionString; var eventStore = new MsSqlServerEventStore(eventStoreConnectionString); Assembly domainAssembly = Assembly.LoadFrom("MyNotes.Domain.dll"); IWindsorContainer container = new WindsorContainer(); container.AddFacility("ncqrs.ds", new DynamicSnapshotFacility(domainAssembly)); container.Register( Component.For<ISnapshottingPolicy>().ImplementedBy<SimpleSnapshottingPolicy>(), Component.For<ICommandService>().Instance(InitializeCommandService()), Component.For<IEventBus>().Instance(InitializeEventBus(buffer)), Component.For<IEventStore>().Forward<ISnapshotStore>().Instance(eventStore), Component.For<IKnownCommandsEnumerator>().Instance(new AllCommandsInAppDomainEnumerator()), Component.For<Note>().AsSnapshotable()); WindsorConfiguration config = new WindsorConfiguration(container); NcqrsEnvironment.Configure(config); }
private static void ConfigureNcqrsEnvironment(InMemoryBufferedBrowsableElementStore buffer) { var eventStoreConnectionString = ConfigurationManager.ConnectionStrings["MyNotes Event Store"].ConnectionString; var eventStore = new MsSqlServerEventStore(eventStoreConnectionString); Assembly domainAssembly = Assembly.LoadFrom("MyNotes.Domain.dll"); IWindsorContainer container = new WindsorContainer(); container.AddFacility("ncqrs.ds", new DynamicSnapshotFacility(domainAssembly)); container.Register( Component.For <ISnapshottingPolicy>().ImplementedBy <SimpleSnapshottingPolicy>(), Component.For <ICommandService>().Instance(InitializeCommandService()), Component.For <IEventBus>().Instance(InitializeEventBus(buffer)), Component.For <IEventStore>().Forward <ISnapshotStore>().Instance(eventStore), Component.For <IKnownCommandsEnumerator>().Instance(new AllCommandsInAppDomainEnumerator()), Component.For <Note>().AsSnapshotable()); WindsorConfiguration config = new WindsorConfiguration(container); NcqrsEnvironment.Configure(config); }
public SampleServer() { _container = WindsorConfiguration.CreateContainer(); _server = CreateServer(); }