本文整理汇总了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;
}
示例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;
}
}
示例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);
}
}
示例4: TagsController
public TagsController(IServiceLocator serviceLocator)
{
_tagsService = serviceLocator.Get<ITagsService>();
}
示例5: MyAccountController
public MyAccountController(IServiceLocator serviceLocator)
{
_memberAuthenticationService = serviceLocator.Get<IMemberAuthenticationService>();
_achievementsService = serviceLocator.Get<IAchievementsService>();
}
示例6: CreateProgressService
private IProgressService CreateProgressService(IServiceLocator locator)
{
return locator.Get<CherryProgressService>();
}
示例7: NuggetsController
public NuggetsController(IServiceLocator serviceLocator)
{
_nuggetService = serviceLocator.Get<INuggetsService>();
_memberAuthenticationService = serviceLocator.Get<IMemberAuthenticationService>();
_tagsService = serviceLocator.Get<ITagsService>();
}
示例8: CommentsController
public CommentsController(IServiceLocator serviceLocator)
{
_commentService = serviceLocator.Get<ICommentsService>();
_memberAuthService = serviceLocator.Get<IMemberAuthenticationService>();
}
示例9: NuggetsService
public NuggetsService(IServiceLocator serviceLocator)
{
_repository = serviceLocator.Get<INuggetsRepository>();
}
示例10: AchievementsService
public AchievementsService(IServiceLocator serviceLocator)
{
_achievementsRepository = serviceLocator.Get<IAchievementsRepository>();
_earnedAchievementsRepository = serviceLocator.Get<IEarnedAchievementsRepository>();
_contentTypeRepository = serviceLocator.Get<IContentTypesRepository>();
}
示例11: MemberAuthenticationService
public MemberAuthenticationService(IServiceLocator serviceLocator)
{
MembersRepository = serviceLocator.Get<IMembersRepository>();
_eventAggregator = serviceLocator.Get<IEventAggregator>();
PasswordSalt = ConfigurationManager.AppSettings["passwordSalt"];
}
示例12: AchievementsController
public AchievementsController(IServiceLocator serviceLocator)
{
_achievementsService = serviceLocator.Get<IAchievementsService>();
}
示例13: VotingService
public VotingService(IServiceLocator serviceLocator)
{
_votesRepository = serviceLocator.Get<IVotesRepository>();
_contentTypeRepository = serviceLocator.Get<IContentTypesRepository>();
_membersAuthService = serviceLocator.Get<IMemberAuthenticationService>();
}
示例14: VotingController
public VotingController(IServiceLocator serviceLocator)
{
_votingService = serviceLocator.Get<IVotingService>();
_contentTypeRepository = serviceLocator.Get<IContentTypesRepository>();
}
示例15: CommentsService
public CommentsService(IServiceLocator serviceLocator)
{
_repository = serviceLocator.Get<ICommentsRepository>();
_contentTypeRepo = serviceLocator.Get<IContentTypesRepository>();
}