static void Main(string[] args) { var builder = new ContainerBuilder(); AhnqIotContainer.Builder = builder; BootStraper.Start(); //Service层启动初始化 BussinessBootStraper.Start(); //Assembly asm = Assembly.ReflectionOnlyLoadFrom("SmartIot.API.Processor.dll"); //Ioc.CurrentIoc.RegisterAssembly(asm); //Ioc.CurrentIoc.RegisterType<ManageDataProcessor, ManageDataProcessor>(); //容器注册完成 //Ioc.CurrentIoc.RegisterDone(); //初始化数据库数据 BussinessBootStraper.InitDatabaseData(); //每10分钟自动释放存一次 _releaseTimerX = new TimerX(obj => Runtime.ReleaseMemory(), null, 5 * 60 * 1000, 10 * 60 * 1000); // ApiService.ServiceMain(); var service = new ApiService(); service.Start(); Console.ReadLine(); }
private void Btn_Change_Departments_Click(object sender, EventArgs e) { var bootstraper = new BootStraper(); var container = bootstraper.Bootstrap(); var departmentsForm = container.Resolve <DepartmentsForm>(); departmentsForm.ShowDialog(); }
/// <summary> /// Выбор варианта поиска сотрудников /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Change_Employees_Click(object sender, EventArgs e) { var bootstraper = new BootStraper(); var container = bootstraper.Bootstrap(); var userForm = container.Resolve <UsersForm>(); userForm.Show(); }
static void Main() { var bootstraper = new BootStraper(); var container = bootstraper.Bootstrap(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(container.Resolve <MainForm>()); }
public static void RegisterComponents() { var container = new UnityContainer(); // register all your components with the container here // it is NOT necessary to register your controllers // e.g. container.RegisterType<ITestService, TestService>(); BootStraper.Init(container); GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container); }
public void Deve_Validar_DynamicProxy_Com_Atributo_Na_Interface() { // arrange var serviceCollection = BootStraper.CreateServiceProvider(); var blogService = serviceCollection.GetRequiredService <IBlogService>(); // act blogService.Invoking(lnq => lnq.Test()).Should().NotThrow(); // assert }
public void Deve_Validar_DynamicProxy_Com_Atributo_Generico() { // arrange var blog = new Blog { Id = 1, Description = "description", Title = "test", CreatedAt = DateTime.Now.Date }; var serviceCollection = BootStraper.CreateServiceProvider(); var blogService = serviceCollection.GetRequiredService <IBlogService>(); // act blogService.Invoking(lnq => lnq.Save(blog)).Should().NotThrow(); // assert }
public void Deve_Validar_DynamicProxy_Com_Atributo() { // arrange var id = 1; var resultadoEsperado = new Blog { Id = id, Description = "description", Title = "test", CreatedAt = DateTime.Now.Date }; var serviceCollection = BootStraper.CreateServiceProvider(); var blogService = serviceCollection.GetRequiredService <IBlogService>(); // act var resultado = blogService.Get(1); // assert resultado.Should().BeEquivalentTo(resultadoEsperado); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Add_new_employee_Click(object sender, EventArgs e) { try { var bootstraper = new BootStraper(); var container = bootstraper.Bootstrap(); var userForm = container.Resolve <NewEmployeeForm>(); if (userForm.ShowDialog() == DialogResult.OK) { Lbx_Emp_details.DataSource = _departmentRepository.GetEmployeesWithDepartment(); MessageBox.Show("Новый сотрудник успешно добавлен", "Employees Operations", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Сотрудник не добавлен !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { throw new NullReferenceException(ex.Message); } }
private void Btn_add_Click(object sender, EventArgs e) { try { var bootstraper = new BootStraper(); var container = bootstraper.Bootstrap(); var departmentsForm = container.Resolve <NewDepartmentForm>(); if (departmentsForm.ShowDialog() == DialogResult.OK) { Dgw_departments.DataSource = _departmentService.GetAllDepartments(); TreeViewInit(); MessageBox.Show("Новый отдел успешно добавлен", "Departments Operations", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Отдел не добавлен !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { throw new NullReferenceException(ex.Message); } }
static void Main(string[] args) { ICarBootStraper BootStraper = new BootStraper(); BootStraper.Run(); }