当前位置: 首页>>代码示例>>C#>>正文


C# IUnityContainer.Resolve方法代码示例

本文整理汇总了C#中IUnityContainer.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IUnityContainer.Resolve方法的具体用法?C# IUnityContainer.Resolve怎么用?C# IUnityContainer.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUnityContainer的用法示例。


在下文中一共展示了IUnityContainer.Resolve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdaterModule

 public UpdaterModule(IUnityContainer container, IRegionManager manager)
 {
     _container = container;
     _regionManager = manager;
     _container.RegisterInstance(_container.Resolve<UpdaterViewModel>());
     _container.RegisterInstance<IEsterViewModel>("updates", _container.Resolve<UpdaterViewModel>());
 }
开发者ID:kib357,项目名称:Ester2,代码行数:7,代码来源:UpdaterModule.cs

示例2: RegisterTopicListeners

        /// <summary>
        /// Register Listeners
        /// </summary>
        public static void RegisterTopicListeners(IUnityContainer pinkoContainer)
        {
            // register topics we are listening to
            var pinkoApplication = pinkoContainer.Resolve<IPinkoApplication>();
            var pinkoConfiguration = pinkoContainer.Resolve<IPinkoConfiguration>();
            var workerRoleFrame = pinkoContainer.Resolve<IWorkerRoleFrame>();

            pinkoApplication.RunInWorkerThread("Initialize PinkoSubscriptionManagerWorker",
                                               () =>
                                               workerRoleFrame.Run(
                                                   pinkoConfiguration.PinkoMessageBusToWorkerSubscriptionManagerAllTopic,
                                                   pinkoConfiguration.PinkoMessageBusToWorkerSubscriptionManagerTopic)
                );

            // Hook to incoming for ALL worker roles
            pinkoApplication.RunInWorkerThread(pinkoConfiguration.PinkoMessageBusToAllWorkersTopic,
                () =>
                pinkoContainer
                    .Resolve<IBusMessageServer>()
                    .GetTopic(pinkoConfiguration.PinkoMessageBusToAllWorkersTopic)
                    .Listen()
                );

            // start listening to Topic messages
            pinkoApplication.RunInWorkerThread("Initialize PinkoCalcEngineWorker",
                                               () =>
                                               workerRoleFrame.Run(
                                                   pinkoConfiguration.PinkoMessageBusToWorkerCalcEngineAllTopic,
                                                   pinkoConfiguration.PinkoMessageBusToWorkerCalcEngineTopic)
                );
        }
开发者ID:cotmechy,项目名称:PinkoAzure,代码行数:34,代码来源:PinkoServiceContainer.cs

示例3: CalculatePlayerForm

        private static void CalculatePlayerForm(IUnityContainer container, ILogger logger)
        {
            logger.Log(Tag.Progress, "Calculating player form (Points per game)");

            var playerFormCalculator = container.Resolve<IPlayerFormCalculator>();
            var playerPoolReducer = container.Resolve<IPlayerPoolReducer>();
            var allPlayers = GetAllPlayers(container, 1);

            var playerForms = (from player in allPlayers
                               let playerForm = playerFormCalculator.CalculateCurrentPlayerForm(player, allPlayers)
                               select new Tuple<Player, PlayerForm>(player, playerForm)).ToList();

            var reducedPlayers = playerPoolReducer.ReducePlayerPool(allPlayers);

            logger.Log(Tag.Prediction, string.Format("Displaying {0} players considered for initial team selection", reducedPlayers.Count));

            foreach (var playerForm in playerForms.Where(pf => reducedPlayers.Contains(pf.Item1)).OrderByDescending(kvp => kvp.Item2.NormalisedPointsPerGame))
            {
                LogPlayerForm(playerForm.Item1, playerForm.Item2, logger);
            }

            var ignoredPlayers = allPlayers.Except(reducedPlayers).ToList();

            logger.Log(Tag.Prediction, string.Format("Displaying {0} players NOT considered for initial team selection", ignoredPlayers.Count));
            foreach (var playerForm in playerForms.Where(pf => ignoredPlayers.Contains(pf.Item1)).OrderByDescending(kvp => kvp.Item2.NormalisedPointsPerGame))
            {
                LogPlayerForm(playerForm.Item1, playerForm.Item2, logger);
            }
        }
开发者ID:robinweston,项目名称:fantasyfootballrobot,代码行数:29,代码来源:SimulationRunner.cs

示例4: FileSystemContentBase

 public FileSystemContentBase(char slash)
 {
     Slash = slash;
     Container = UnityInstance.Container;
     EventAggregator = Container.Resolve<IEventAggregator>();
     ResourceManager = Container.Resolve<IResourceManager>();
 }
开发者ID:mousetwentytwo,项目名称:test,代码行数:7,代码来源:FileSystemContentBase.cs

示例5: InitializeServices

 private void InitializeServices(IUnityContainer container)
 {
     var logger = container.Resolve<ILogger>();
     logger.Info("Initializing Elevation data and Elastic Search Service");
     container.Resolve<IElasticSearchGateway>().Initialize();
     container.Resolve<IElevationDataStorage>().Initialize().ContinueWith(task => logger.Info("Finished loading elevation data from files."));
 }
开发者ID:IsraelHikingMap,项目名称:Site,代码行数:7,代码来源:Startup.cs

示例6: ConfigureUnityContainer

        public static void ConfigureUnityContainer(IUnityContainer container)
        {
            //Registrations
            #region Repository
            container.RegisterType<NHibernateSessionFactory, SessionFactory>
                                    (new ContainerControlledLifetimeManager());
            var factory = container.Resolve<SessionFactory>();
            var injectedFactory = new InjectionConstructor(factory);
            container.RegisterType<IRepository, NHibernateRepository>
                                    (new ContextLifetimeManager<IRepository>(), injectedFactory);
            #endregion

            #region Facebook
            var fbSettings = ConfigurationManager.GetSection("facebookSettings") as FacebookConfigurationSection;
            var injectedFBSettings = new InjectionConstructor(fbSettings.AppId,fbSettings.AppSecret);
            container.RegisterType<FacebookClient, FacebookWebClient>(injectedFBSettings);
            #endregion

            #region Logger

            container.RegisterType<Log4NetFactory, LogFactory>
                                    (new ContainerControlledLifetimeManager());
            var logFactory = container.Resolve<LogFactory>();

            var injectedLogFactory = new InjectionConstructor(logFactory);
            container.RegisterType<ILogger, Log4Net>
                                    (new ContainerControlledLifetimeManager(),injectedLogFactory);
            #endregion
        }
开发者ID:UrK,项目名称:kululu_v1,代码行数:29,代码来源:Initializer.cs

示例7: Main

        public static void Main(string[] args)
        {
            if (args.Length != 0)
            {
                return;
            }

            Container = new UnityContainer().LoadConfiguration("snmptrapd");

            var trapv1 = Container.Resolve<TrapV1MessageHandler>("TrapV1Handler");
            trapv1.MessageReceived += WatcherTrapV1Received;
            var trapv2 = Container.Resolve<TrapV2MessageHandler>("TrapV2Handler");
            trapv2.MessageReceived += WatcherTrapV2Received;
            var inform = Container.Resolve<InformMessageHandler>("InformHandler");
            inform.MessageReceived += WatcherInformRequestReceived;
            using (var engine = Container.Resolve<SnmpEngine>())
            {
                engine.Listener.AddBinding(new IPEndPoint(IPAddress.Any, 162));
                engine.Start();
                Console.WriteLine("#SNMP is available at http://sharpsnmplib.codeplex.com");
                Console.WriteLine("Press any key to stop . . . ");
                Console.Read();
                engine.Stop();
            }
        }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:25,代码来源:Program.cs

示例8: ContentController

		public ContentController(IUnityContainer container) {
			this.container = container;
			regionManager = container.Resolve<IRegionManager>();
			eventAggregator = container.Resolve<IEventAggregator>();

			Subscribe();
		}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:7,代码来源:ContentController.cs

示例9: ProjectIssuesViewModel

        public ProjectIssuesViewModel(IUnityContainer container)
        {
            HeaderTitle = "Issues";

            _container = container;
            _context = _container.Resolve<TeamManagerDomainContext>("TM_DB");
            _modalDialogService = _container.Resolve<IModalDialogService>();
            _messageBoxService = _container.Resolve<IMessageBoxService>();

            Messanger.Get<ProjectSelectionMessage>().Subscribe(OnSelectedProjectChanged);

            GroupCriteria = new ObservableCollection<GroupItem>(new List<GroupItem>
                                                                    {
                                                                        new GroupItem("Tracker", "Tracker.Name"),
                                                                        new GroupItem("Priority", "Priority.Name"),
                                                                        new GroupItem("Creator", "Creator.UserName"),
                                                                        new GroupItem("Assigned member", "AssignedUser.UserName"),
                                                                    });

            EditIssueCommand = new DelegateCommand<Issue>(ExecuteEditIssue, issue => true);
            CreateIssueCommand = new DelegateCommand(ExecuteCreateIssue, CanExecuteCreateIssue);
            DeleteIssueCommand = new DelegateCommand<Issue>(ExecuteDeleteIssue, issue => true);
            OpenIssueCommand = new DelegateCommand<Issue>(ExecuteIssueNavigate, issue => true);
            GroupChangedCommand = new DelegateCommand<SelectionChangedEventArgs>(GroupChangedHandler, e => true);
            ClearGroupingCommand = new DelegateCommand(ClearGroupingExecute, () => true);
        }
开发者ID:berdyshev,项目名称:TeamManager,代码行数:26,代码来源:ProjectIssuesViewModel.cs

示例10: Init

        public void Init()
        {
            Container = new UnityContainer();
            Container.AddNewExtension<EnterpriseLibraryCoreExtension>();
            Container.RegisterType<ILogHandler, LogHandler>();
            Container.RegisterType<IConsoleRepository, ConsoleRepository>();
            
            
            var mockCurrentHttpContext = new Mock<ICurrentHttpContext>();
            var user = @"talbotdev\MurrayE";
            user = user.Replace(@"\\", @"\");
            mockCurrentHttpContext.Setup(h => h.CurrentUser).Returns(new GenericPrincipal(new GenericIdentity(user), null));
            mockCurrentHttpContext.Setup(h => h.Context).Returns(MvcMockHelpers.FakeHttpContextWithSession());
            var currentHttpContext = mockCurrentHttpContext.Object;

            var mockSubscribeService = new Mock<IPolicyService>();
            IPolicyService subscribeService = mockSubscribeService.Object;

            IPolicyData policyData = Container.Resolve<PolicyData>(new ParameterOverride("currentHttpContext", currentHttpContext));
            IWebSiteModuleManager webSiteModuleManager = Container.Resolve<WebSiteModuleManager>(new ParameterOverride("currentHttpContext", currentHttpContext));

            PolicyBusinessModule = Container.Resolve<PolicyBusinessModule>(
                new ParameterOverride("policyData", policyData), 
                new ParameterOverride("subscribeService", subscribeService),
                new ParameterOverride("webSiteModuleManager", webSiteModuleManager));
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:26,代码来源:PolicyBusinessModuleIntegrationTestFixture.cs

示例11: SessionData

 public SessionData(IUnityContainer container)
 {
     this.container = container;
     Customer = container.Resolve<ICustomerVM>();
     repository = container.Resolve<IDataRepository>();
     repository.DataChanged += OnCustomerChanged;
 }
开发者ID:JWroe,项目名称:ScrapTraders,代码行数:7,代码来源:SessionData.cs

示例12: Main

        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                return;
            }

            Container = new UnityContainer();
            Container.LoadConfiguration("agent");

            // TODO: this is a hack. review it later.
            var store = Container.Resolve<ObjectStore>();
            store.Add(new SysDescr());
            store.Add(new SysObjectId());
            store.Add(new SysUpTime());
            store.Add(new SysContact());
            store.Add(new SysName());
            store.Add(new SysLocation());
            store.Add(new SysServices());
            store.Add(new SysORLastChange());
            store.Add(new SysORTable());
            
            var users = Container.Resolve<UserRegistry>();
            users.Add(new OctetString("neither"), DefaultPrivacyProvider.DefaultPair);
            users.Add(new OctetString("authen"), new DefaultPrivacyProvider(new MD5AuthenticationProvider(new OctetString("authentication"))));
            users.Add(new OctetString("privacy"), new DESPrivacyProvider(new OctetString("privacyphrase"),
                                                                         new MD5AuthenticationProvider(new OctetString("authentication"))));
            
            ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }   
开发者ID:xxjeng,项目名称:nuxleus,代码行数:33,代码来源:Program.cs

示例13: ExceptionWrapTest

 public void ExceptionWrapTest()
 {
     // arrange
     Container = new UnityContainer().LoadConfiguration("snmptrapd");
     /*
     var users = ExceptionWrapTests.Container.Resolve<UserRegistry>();
     users.Add(new OctetString("neither"),
         DefaultPrivacyProvider.DefaultPair);
     users.Add(new OctetString("authen"),
         new DefaultPrivacyProvider(new MD5AuthenticationProvider(new OctetString("authentication"))));
     users.Add(new OctetString("privacy"),
         new DESPrivacyProvider(new OctetString("privacyphrase"),
         new MD5AuthenticationProvider(new OctetString("authentication"))));
      */
     var trapv2 = Container.Resolve<TrapV2MessageHandler>("TrapV2Handler");
     trapv2.MessageReceived += WatcherTrapV2Received;
     using (var engine = Container.Resolve<SnmpEngine>())
     {
         engine.Listener.AddBinding(new IPEndPoint(IPAddress.Any, 162));
         engine.Start();
     }
     // act
     ExceptionWrap e = new ExceptionWrap();
     e.send();
     // assert
     Assert.AreEqual(test, 162);
 }
开发者ID:EhevuTov,项目名称:csharp-lib-exception-snmp,代码行数:27,代码来源:ExceptionWrapTests.cs

示例14: LateNightShellModel

        /// <summary>
        /// Creates a new instance of <c>LateNightShellModel</c>.
        /// </summary>
        public LateNightShellModel(IUnityContainer container)
        {
            this.container = container;

            ShowAboutCommand = new DelegateCommand<object>(DoShowAboutExecuted);
            ExitApplicationCommand = new DelegateCommand<object>(DoExitApplicationExecuted);

            DocumentController = container.Resolve<IDocumentController>(
                ControllerNames.DocumentController);
            SystemDocumentController = container.Resolve<IDocumentController>(
                ControllerNames.SystemDocumentController);

            CloseCurrentDocumentCommand = new DelegateCommand<object>(
                DoCloseCurrentDocument, CanCloseCurrentDocument);

            CloseDocumentCommand = new DelegateCommand<AbstractDocument>(
                DocumentController.CloseDocument);

            DocumentController.DocumentOpened
                += new EventHandler<DataEventArgs<AbstractDocument>>(DoReevaluateCloseCurrentDocumentCommand);
            DocumentController.DocumentClosed
                += new EventHandler<DataEventArgs<AbstractDocument>>(DoReevaluateCloseCurrentDocumentCommand);

            Properties.Settings.Default.PropertyChanged += new PropertyChangedEventHandler(DoSettingsPropertyChanged);
            if (Properties.Settings.Default.AlwaysShowMenu) {
                MenuVisibility = Visibility.Visible;
            } else {
                MenuVisibility = Visibility.Collapsed;
            }
        }
开发者ID:wcrooy,项目名称:cwpfsamples,代码行数:33,代码来源:LateNightShellModel.cs

示例15: Init

        public static void Init(TestContext context)
        {
            GetMockSubscribeService();
            GetMockCurrentHttpContext();
            CreateBasicSubmission();
            CreateComplexSubmission();
            CreateBasicEnergySubmission();
            CreateComplexEnergySubmission();
            CreateBasicCargoSubmission();
            CreateComplexCargoSubmission();
            CreateBasicHullSubmission();
            CreateComplexHullSubmission();
            CreateBasicMarineSubmission();
            CreateComplexMarineSubmission();
                        
            _container = new UnityContainer();
            _container.AddNewExtension<EnterpriseLibraryCoreExtension>();
            _container.RegisterType<ILogHandler, LogHandler>();
            _container.RegisterType<IConsoleRepository, ConsoleRepository>();
            _container.RegisterType<IWebSiteModuleManager, WebSiteModuleManager>();
            var mockPolicyData = new Mock<IPolicyData>();
            //_container.RegisterType<IPolicyData, PolicyData>();
            _container.RegisterInstance(typeof(IPolicyData), mockPolicyData.Object);
            var consoleRepository = _container.Resolve<IConsoleRepository>();

            SaveTestSubmission(consoleRepository);

            _submissionModule =
                _container.Resolve<SubmissionModule>(new ParameterOverride("currentHttpContext", _currentHttpContext),
                                                    new ParameterOverride("subscribeService", _mockSubscribeService));
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:31,代码来源:SubmissionModuleIntegrationTestFixture.cs


注:本文中的IUnityContainer.Resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。