Exemplo n.º 1
0
        /// <summary>
        /// 接口注入
        /// </summary>
        public static void Register()
        {
            NinjectDependencyResolver Resolver = new NinjectDependencyResolver();

            //工资接口
            Resolver.Register<ISalaryInfoBiz, SalaryInfoBiz>();
            //应聘公司接口
            Resolver.Register<ICompanieBiz, CompanieBiz>();
            //用户接口
            Resolver.Register<IUserInfoBiz, UserInfoBiz>();

            DependencyResolver.SetResolver(Resolver);
        }
Exemplo n.º 2
0
        public IEnumerable <IActionInvoker> GetActionInvokers()
        {
            NinjectDependencyResolver dependencyResolver = (NinjectDependencyResolver)DependencyResolver.Current;

            yield return(this.CreateActionInvoker());

            this.ClearCachedActionInvokers();
            dependencyResolver.Register <IActionInvoker, SyncActionInvoker>();
            yield return(this.CreateActionInvoker());

            this.ClearCachedActionInvokers();
            dependencyResolver.Register <IAsyncActionInvoker, AsyncActionInvoker>();
            yield return(this.CreateActionInvoker());
        }
Exemplo n.º 3
0
        public IEnumerable <IActionInvoker> GetActionInvokers()
        {
            NinjectDependencyResolver dependencyResolver = (NinjectDependencyResolver)DependencyResolver.Current;

            //1. 默认创建的ActionInvoker
            yield return(this.CreateActionInvoker());

            //2. 为Dependency注册针对IActionInvoker的类型映射
            dependencyResolver.Register <IActionInvoker, SyncActionInvoker>();
            yield return(this.CreateActionInvoker());

            //3. 为Dependency注册针对IAsyncActionInvoker的类型映射
            dependencyResolver.Register <IAsyncActionInvoker, AsyncActionInvoker>();
            yield return(this.CreateActionInvoker());
        }
Exemplo n.º 4
0
        protected void Application_Start()
        {
            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();

            dependencyResolver.Register <IProductService, ProductService>();
            GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver;
        }
Exemplo n.º 5
0
        protected void Application_Start(object sender, EventArgs e)
        {
            //注册全局的动作 即每跳转一个节点,都会执行动作。
            WorkflowGlobalServiceProvider.RegisterGlobalService(typeof(PendingAction));
            WorkflowGlobalServiceProvider.RegisterGlobalService(typeof(RecordAction));
            WorkflowGlobalServiceProvider.RegisterGlobalService(typeof(FormAction));

            //注册局部动作即跳转到特定节点中执行的动作
            WorkflowGlobalServiceProvider.RegisterPartService(new EmptyAction());



            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();


            dependencyResolver.Register <IBridgeService, BridgeService>();
            dependencyResolver.Register <IQuery <IList <Category> >, CategoryService>();
            dependencyResolver.Register <IPendingService, PendingService>();
            dependencyResolver.Register <IQuery <IList <Record>, string>, RecordService>();
            dependencyResolver.Register <IQuery <IList <Constraint> >, ConstraintService>();
            dependencyResolver.Register <AbstractBridgeService, BaseBridgeService>();
            dependencyResolver.Register <IActorService, ActorService>();

            GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver;

            GlobalConfiguration.Configuration.Routes.MapHttpRoute(
                name: "ActionApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional });
        }
Exemplo n.º 6
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     NinjectDependencyResolver dependencyResovler = new NinjectDependencyResolver();
     dependencyResovler.Register<ResourceReader, DefaultResourceReader>();
     DependencyResolver.SetResolver(dependencyResovler);
 }
Exemplo n.º 7
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();
            dependencyResolver.Register<IEmployeeRepository, EmployeeRepository>();
            DependencyResolver.SetResolver(dependencyResolver);
        }
Exemplo n.º 8
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            NinjectDependencyResolver dependecyResolver = new NinjectDependencyResolver();

            dependecyResolver.Register <IEmployeeRepository, EmployeeRepository>();
            DependencyResolver.SetResolver(dependecyResolver);
        }
Exemplo n.º 9
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();

            dependencyResolver.Register <Itestservice, testservice>();
            GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver;
        }
Exemplo n.º 10
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();
            dependencyResolver.Register<IContactRepository, DefaultContactRepository>();
            GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver; 

        }
Exemplo n.º 11
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            //依赖注入
            NinjectDependencyResolver dependencyResovler = new NinjectDependencyResolver();
            dependencyResovler.Register<ResourceReader, DefaultResourceReader>();
            DependencyResolver.SetResolver(dependencyResovler);

            //自定义ViewEngines
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new SimpleRazorViewEngine());
        }
Exemplo n.º 12
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var config = GlobalConfiguration.Configuration;

            config.Filters.Add(new ArgumentCheckAttribute());

            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();

            dependencyResolver.Register <ISummaryService, SummaryService>();
            dependencyResolver.Register <IBridgeService, BridgeService>();
            dependencyResolver.Register <IQuery <IList <Category> >, CategoryService>();
            dependencyResolver.Register <IPendingService, PendingService>();
            dependencyResolver.Register <IQuery <List <Record>, string>, RecordService>();
            dependencyResolver.Register <IQuery <IList <Constraint> >, ConstraintService>();
            dependencyResolver.Register <AbstractBridgeService, BaseBridgeService>();
            dependencyResolver.Register <IOrganizationService, OrganizationService>();
            dependencyResolver.Register <IActorService, ActorService>();

            GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver;

            //注册全局的动作 即每跳转一个节点,都会执行动作。
            WorkflowGlobalServiceProvider.RegisterGlobalService(typeof(PendingAction));
            WorkflowGlobalServiceProvider.RegisterGlobalService(typeof(RecordAction));

            //抄送动作
            WorkflowGlobalServiceProvider.RegisterGlobalService(typeof(CarbonCopyAction));

            //注册局部动作 即跳转到特定节点中执行的动作
            WorkflowGlobalServiceProvider.RegisterPartService(new EmptyAction());

            //config.Routes.MapHttpRoute(
            //       name: "DefaultApi",
            //       routeTemplate: "api/{controller}/{id}",
            //       defaults: new { id = RouteParameter.Optional });

            config.Routes.MapHttpRoute(
                name: "ActionApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional });
        }
Exemplo n.º 13
0
        protected void Application_Start()
        {
            //Database.SetInitializer(new InitializeDBWithSeedData());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            NinjectDependencyResolver dependencyResolver = new NinjectDependencyResolver();
            dependencyResolver.Register<IVideoRepository, VideoRepository>();
            dependencyResolver.Register<IVideoService, VideoService>();
            dependencyResolver.Register<IVideoCatRepository, VideoCatRepository>();
            dependencyResolver.Register<IVideoCatService, VideoCatService>();
            dependencyResolver.Register<IDocRepository, DocRepository>();
            dependencyResolver.Register<IDocService, DocService>();
            dependencyResolver.Register<IDocCatRepository, DocCatRepository>();
            dependencyResolver.Register<IDocCatService, DocCatService>();
            dependencyResolver.Register<IRecordRepository, RecordRepository>();
            dependencyResolver.Register<IRecordService, RecordService>();
            dependencyResolver.Register<ILoginInfoRepository, LoginInfoRepository>();
            dependencyResolver.Register<ILoginInfoService, LoginInfoService>();
            dependencyResolver.Register<IMonthLoginCountRepository, MonthLoginCountRepository>();
            dependencyResolver.Register<IMonthLoginCountService, MonthLoginCountService>();
            DependencyResolver.SetResolver(dependencyResolver);
        }