Ejemplo n.º 1
0
        private IComponentContext componentContext;//Autofac上下文

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_componentContext"></param>
        /// <param name="_userInfoService"></param>
        public TestController(IComponentContext _componentContext, ITest_UserInfoService _userInfoService)
        {
            //默认
            userInfoService = _userInfoService;
            ////指定V1
            //_v1userInfoService = _componentContext.ResolveNamed<IUserInfoService>(typeof(MyAutofac.Api.Service.v1.UserInfoService).Name);
            ////指定V2
            //_v2userInfoService = _componentContext.ResolveNamed<IUserInfoService>(typeof(MyAutofac.Api.Service.v2.UserInfoService).Name);
            ////指定V0
            //_v0userInfoService = _componentContext.ResolveNamed<IUserInfoService>(typeof(MyAutofac.Api.Service.V0UserInfoService).Name);
            ////指定V3
            //_v3userInfoService = _componentContext.ResolveNamed<IUserInfoService>(typeof(MyAutofac.Api.Service.v3.UserInfoService).Name);
        }
Ejemplo n.º 2
0
        private IComponentContext componentContext;//Autofac上下文

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_componentContext"></param>
        /// <param name="_userInfoService"></param>
        public TestJob(IComponentContext _componentContext, ITest_UserInfoService _userInfoService)
        {
            //默认
            userInfoService = _userInfoService;
        }