public PunchIn() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _employeeAttendanceInfoService = kernel.GetService(typeof(EmployeeAttendanceInformationService)) as EmployeeAttendanceInformationService; _emplyeeService = kernel.GetService(typeof(EmployeeService)) as EmployeeService; }
public ProductSearchForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _productCategoryService = kernel.GetService(typeof(ProductCategoryService)) as ProductCategoryService; _productService = kernel.GetService(typeof(ProductService)) as ProductService; _productCategory = new ProductCategoryModel(); }
public ModuleForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _moduleService = kernel.GetService(typeof(ModuleService)) as ModuleService; _applicationService = kernel.GetService(typeof(ApplicationService)) as ApplicationService; _module = new ModuleModel(); }
public PurchaseReceiveForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _purchaseReceiveService = kernel.GetService(typeof(PurchaseReceiveService)) as PurchaseReceiveService; _purchaseChallanService = kernel.GetService(typeof(PurchaseChallanService)) as PurchaseChallanService; _purchaseReceive = new PurchaseReceiveModel(); }
public PurchaseChallanForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _purchaseChallanService = kernel.GetService(typeof(PurchaseChallanService)) as PurchaseChallanService; _supplierService = kernel.GetService(typeof(SupplierService)) as SupplierService; _purchaseChallan = new PurchaseChallanModel(); }
public EmployeeInformationForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _employeeInformationService = kernel.GetService(typeof(EmployeeInformationService)) as EmployeeInformationService; _departmentService = kernel.GetService(typeof(DepartmentService)) as DepartmentService; _designationService = kernel.GetService(typeof(DesignationService)) as DesignationService; _employeeInformation = new EmployeeInformationModel(); }
public object GetService(Type serviceType) { IComponentRegistration registration = null; if (_servicesByInterface.TryGetValue(serviceType, out registration)) { return(Get(registration)); } return((null == _parent) ? null : _parent.GetService(serviceType)); }
public PurchaseChallanDetailsForm(PurchaseChallanModel purchaseChallan) { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _purchaseChallanDetailService = kernel.GetService(typeof(PurchaseChallanDetailService)) as PurchaseChallanDetailService; _productCategoryService = kernel.GetService(typeof(ProductCategoryService)) as ProductCategoryService; _productService = kernel.GetService(typeof(ProductService)) as ProductService; _purchaseChallan = purchaseChallan; _purchaseChallanDetail = new PurchaseChallanDetailModel(); }
public UserInformationForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _userInformationService = kernel.GetService(typeof(UserInformationService)) as UserInformationService; _userTypeService = kernel.GetService(typeof(UserTypeService)) as UserTypeService; _employeeInformationService = kernel.GetService(typeof(EmployeeInformationService)) as EmployeeInformationService; _roleService = kernel.GetService(typeof(RoleService)) as RoleService; _userInformation = new UserInformationModel(); }
//decimal _descountInPercentage = 0; //decimal _discountAmount = 0; //decimal _vatInPercentage = 0; //decimal _vatAmount = 0; //decimal _serviceCharge = 0; //decimal _netAmount = 0; #endregion #region Constructor public SaleForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _saleService = kernel.GetService(typeof(SaleService)) as SaleService; _saleDetailService = kernel.GetService(typeof(SaleDetailService)) as SaleDetailService; _sale = new SaleModel(); _saleDetail = new SaleDetailModel(); _saleDetailList = new List <SaleDetailModel>(); }
public ProductStoreForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _productStoreService = kernel.GetService(typeof(ProductStoreService)) as ProductStoreService; _purchaseReceiveService = kernel.GetService(typeof(PurchaseReceiveService)) as PurchaseReceiveService; _purchaseReceiveDetailService = kernel.GetService(typeof(PurchaseReceiveDetailService)) as PurchaseReceiveDetailService; _productUnitService = kernel.GetService(typeof(ProductUnitService)) as ProductUnitService; _productSectionService = kernel.GetService(typeof(ProductSectionService)) as ProductSectionService; _productStore = new ProductStoreModel(); }
protected IQueryable <TDto> ApplyFiltering <TDto>(KendoGridRequest request, IQueryable <TDto> collection) { var filterCount = request.Filter?.Filters?.Count; if (filterCount == null || filterCount == 0) { return(collection); } var filterExpressionBuilder = (FilterExpressionBuilder <TDto>)_serviceLocator.GetService(typeof(IFilterExpressionBuilder <TDto>)); return(filterExpressionBuilder.CreatedFilteredCollection(collection, request.Filter)); }
public LoginForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _userInformationService = kernel.GetService(typeof(UserInformationService)) as UserInformationService; }
public SupplierInformationForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _supplierService = kernel.GetService(typeof(SupplierService)) as SupplierService; _supplierModel = new SupplierModel(); }
public ProductPriceForm(PurchaseReceiveDetailModel purchaseReceiveDetail) { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _productPriceService = kernel.GetService(typeof(ProductPriceService)) as ProductPriceService; _purchaseReceiveDetail = purchaseReceiveDetail; }
/// <summary> /// Creates a delegate factory based on the actorName /// </summary> /// <param name="actorName">Name of the ActorType</param> /// <returns>factory delegate</returns> public Func <ActorBase> CreateActorFactory(string actorName) { return(() => { Type actorType = this.GetType(actorName); return (ActorBase)container.GetService(actorType); }); }
public ProductUnitForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _productUnitService = kernel.GetService(typeof(ProductUnitService)) as ProductUnitService; _productUnit = new ProductUnitModel(); }
public RoleForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _roleService = kernel.GetService(typeof(RoleService)) as RoleService; _role = new RoleModel(); }
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { var constructor = controllerType.GetConstructors().First(); var parameters = constructor .GetParameters() .Select(argument => _kernel.GetService(argument.ParameterType)) .ToArray(); return((IController)constructor.Invoke(parameters)); }
public ApplicationContext(string[] args) { _args = args; Kernel = CreateKernel(); log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config")); var output = Kernel.GetService <TextWriter>(); output.WriteLine("deployd-mini"); output.WriteLine("version: " + GetType().Assembly.GetName().Version); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices( IKernel kernel ) { string path = new Uri( Path.GetDirectoryName( typeof( NinjectWebCommon ).Assembly.CodeBase ) ?? "" ).LocalPath; string thisNamespace = typeof( NinjectWebCommon ).FullName.Split( new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries )[0]; // FRAGILE: ASSUME: All our code is in this namespace kernel.Bind( x => x .FromAssembliesInPath( path ) // Blows with "not marked as serializable": , a => a.FullName.StartsWith( assemblyPrefix ) ) .Select( type => type.IsClass && !type.IsAbstract && type.FullName.StartsWith( thisNamespace ) ) // .SelectAllClasses() wires up everyone else's stuff too .BindDefaultInterface() .Configure( b => b.InRequestScope() ) ); // Add other bindings as necessary kernel.Rebind<IBetaSigmaPhiContext>().ToMethod( _ => (IBetaSigmaPhiContext)kernel.GetService( typeof(BetaSigmaPhiContext) ) ); // Initialize the service locator ServiceLocator.Initialize( kernel.GetService ); }
public static object GetService(Type type) { return(kernel.GetService(type)); }
/// <summary> /// Get service instance /// </summary> /// <param name="instanceContext">Instance context</param> /// <param name="message">Message</param> /// <returns></returns> public object GetInstance(InstanceContext instanceContext, Message message) { return(_kernel.GetService(ServiceType)); }
public IHub Create(HubDescriptor descriptor) { return((IHub)container.GetService(descriptor.HubType)); }
/// <summary> /// Gets the service object of the specified type. /// </summary> /// <returns> /// A service object of type <paramref name="serviceType" />. /// -or- /// null if there is no service object of type <paramref name="serviceType" />. /// </returns> /// <param name="serviceType"> /// An object that specifies the type of service object to get. /// </param> object IServiceProvider.GetService(Type serviceType) { return(_kernel.GetService(serviceType)); }
public static T GetService <T>() where T : class { return((T)_kernel.GetService(typeof(T))); }
/// <summary> /// Call the Ninject Kernel to get an IRepository of type T /// </summary> /// <typeparam name="T">The type of IRepository to get</typeparam> /// <returns>IRepository of type T</returns> public virtual IRepository <T> Get <T>() where T : class, IIdentifiable { return(_kernel.GetService(typeof(IRepository <T>)) as IRepository <T>); }
public static object GetResolveService(Type typeService) { return((typeService != null) ? _kernel.GetService(typeService) : null); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IAutoContextFactory>() .To<AutoContextFactory>() .InSingletonScope() .OnActivation(x => x.AddAssemblyContaining<Post>().AddAssemblyContaining<HomeController>().AddEntitiesBasedOn<Entity>()); kernel.Bind<DbContext>() .ToMethod(x => kernel.Get<IAutoContextFactory>().Context()).InRequestScope() .WithConstructorArgument("connectionString", x => WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); kernel.Bind( x => x.FromAssemblyContaining<PostController>() .SelectAllClasses() .InheritedFrom<Profile>() .BindBase() .Configure(c => c.InSingletonScope())); kernel.Bind<Highlighter>().ToSelf().InSingletonScope(); Mapper.Initialize(x => { var profiles = typeof (PostController).Assembly.GetTypes() .Where(t => typeof (Profile).IsAssignableFrom(t)) .Union(typeof (Post).Assembly.GetTypes().Where(c => typeof (Profile).IsAssignableFrom(c))); foreach (var profile in profiles) x.AddProfile(kernel.GetService(profile) as Profile); x.ConstructServicesUsing(type => kernel.Get(type)); }); }
public object Create(Type type) { return(_kernel.GetService(type)); }
public object GetService(Type serviceType) { return(kernel.GetService(serviceType)); }
/// <summary> /// Creates a delegate factory used to create actors based on their type /// </summary> /// <param name="actorType">The type of actor that the factory builds</param> /// <returns>A delegate factory used to create actors</returns> public Func <ActorBase> CreateActorFactory(Type actorType) { return(() => (ActorBase)container.GetService(actorType)); }