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


C# IServiceLocator.Get方法代码示例

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


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

示例1: AchievementListener

        public AchievementListener(IServiceLocator serviceLocator)
        {
            _contentTypesRepo = serviceLocator.Get<IContentTypesRepository>();
            _earnedAchievementsRepo = serviceLocator.Get<IEarnedAchievementsRepository>();
            _achievementsRepo = serviceLocator.Get<IAchievementsRepository>();

            this.serviceLocator = serviceLocator;
        }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:8,代码来源:AchievementListener.cs

示例2: Xero2ExcelWinForm

        public Xero2ExcelWinForm(IExcelApplicationWrapper excelApplication, IServiceLocator serviceLocator)
        {
            InitializeComponent();

            _excelApplication = excelApplication;

            _configurationManager = serviceLocator.Get<IBindingConfigurationManager>();
            _connectionManager = serviceLocator.Get<IConnectionManager>();

            // Populate the list of interface names
            foreach (EntityBase entity in _configurationManager.GetRegisteredApiEntities())
            {
                interfaceNameCombobox.Items.Add(entity);
            }

            // Select the first item in the list
            if (interfaceNameCombobox.Items.Count > 0)
            {
                interfaceNameCombobox.SelectedIndex = 0;
            }
        }
开发者ID:danbarratt,项目名称:Xero2Excel,代码行数:21,代码来源:Xero2ExcelWinForm.cs

示例3: DispatchMessages

 public void DispatchMessages(IServiceLocator childServiceLocator, IEnumerable<object> messages, IMessageContext messageContext) {
     Exception exception = null;
     try {
         OnDispatching(childServiceLocator, messages, messageContext);
         foreach (var message in messages) {
             var messageType = message.GetType();
             foreach (var messageHandlerDispatchInfo in messageHandlers.GetOrderedDispatchInfoFor(messageType))
             {
                 var handler = childServiceLocator.Get(messageHandlerDispatchInfo.InstanceType);
                 var tryDisposeHandler = false;
                 if (handler == null)
                 {
                     handler = Activator.CreateInstance(messageHandlerDispatchInfo.InstanceType);
                     tryDisposeHandler = true;
                 }
                 childServiceLocator.BuildUp(handler);
                 try
                 {
                     Logger.DebugFormat("Dispatching message {0} to handler {1}", messageType, handler);
                     messageHandlerDispatchInfo.Invoke(handler, message);
                 }
                 finally
                 {
                     if (tryDisposeHandler && handler is IDisposable)
                     {
                         ((IDisposable)handler).Dispose();
                     }
                 }
             }
         }
     } catch (Exception e) {
         exception = e;
         if (exception is TargetInvocationException && exception.InnerException != null) {
             exception = e.InnerException;
         }
         Logger.Warn("Failed Dispatching Messages for message with ID=" + messageContext.MessageId, exception);
         OnDispatchException(childServiceLocator, messages, messageContext, exception);
         throw;
     } finally {
         OnDispatched(childServiceLocator, messages, messageContext, exception);
     }
 }
开发者ID:jdaigle,项目名称:CWServiceBus,代码行数:42,代码来源:MessageDispatcher.cs

示例4: TagsController

 public TagsController(IServiceLocator serviceLocator)
 {
     _tagsService = serviceLocator.Get<ITagsService>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:4,代码来源:TagsController.cs

示例5: MyAccountController

 public MyAccountController(IServiceLocator serviceLocator)
 {
     _memberAuthenticationService = serviceLocator.Get<IMemberAuthenticationService>();
     _achievementsService = serviceLocator.Get<IAchievementsService>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:5,代码来源:MyAccountController.cs

示例6: CreateProgressService

 private IProgressService CreateProgressService(IServiceLocator locator)
 {
     return locator.Get<CherryProgressService>();
 }
开发者ID:ChristianEder,项目名称:Cherry,代码行数:4,代码来源:ProgressTests.Cherry.cs

示例7: NuggetsController

 public NuggetsController(IServiceLocator serviceLocator)
 {
     _nuggetService = serviceLocator.Get<INuggetsService>();
     _memberAuthenticationService = serviceLocator.Get<IMemberAuthenticationService>();
     _tagsService = serviceLocator.Get<ITagsService>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:6,代码来源:NuggetsController.cs

示例8: CommentsController

 public CommentsController(IServiceLocator serviceLocator)
 {
     _commentService = serviceLocator.Get<ICommentsService>();
     _memberAuthService = serviceLocator.Get<IMemberAuthenticationService>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:5,代码来源:CommentsController.cs

示例9: NuggetsService

 public NuggetsService(IServiceLocator serviceLocator)
 {
     _repository = serviceLocator.Get<INuggetsRepository>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:4,代码来源:NuggetsService.cs

示例10: AchievementsService

 public AchievementsService(IServiceLocator serviceLocator)
 {
     _achievementsRepository = serviceLocator.Get<IAchievementsRepository>();
     _earnedAchievementsRepository = serviceLocator.Get<IEarnedAchievementsRepository>();
     _contentTypeRepository = serviceLocator.Get<IContentTypesRepository>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:6,代码来源:AchievementsService.cs

示例11: MemberAuthenticationService

 public MemberAuthenticationService(IServiceLocator serviceLocator)
 {
     MembersRepository = serviceLocator.Get<IMembersRepository>();
     _eventAggregator = serviceLocator.Get<IEventAggregator>();
     PasswordSalt = ConfigurationManager.AppSettings["passwordSalt"];
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:6,代码来源:MembersAuthenticationService.cs

示例12: AchievementsController

 public AchievementsController(IServiceLocator serviceLocator)
 {
     _achievementsService = serviceLocator.Get<IAchievementsService>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:4,代码来源:AchievementsController.cs

示例13: VotingService

 public VotingService(IServiceLocator serviceLocator)
 {
     _votesRepository = serviceLocator.Get<IVotesRepository>();
     _contentTypeRepository = serviceLocator.Get<IContentTypesRepository>();
     _membersAuthService = serviceLocator.Get<IMemberAuthenticationService>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:6,代码来源:VotingService.cs

示例14: VotingController

 public VotingController(IServiceLocator serviceLocator)
 {
     _votingService = serviceLocator.Get<IVotingService>();
     _contentTypeRepository = serviceLocator.Get<IContentTypesRepository>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:5,代码来源:VotingController.cs

示例15: CommentsService

 public CommentsService(IServiceLocator serviceLocator)
 {
     _repository = serviceLocator.Get<ICommentsRepository>();
     _contentTypeRepo = serviceLocator.Get<IContentTypesRepository>();
 }
开发者ID:Fodsuk,项目名称:TheNuggetList,代码行数:5,代码来源:CommentsService.cs


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