本文整理汇总了C#中IObjectContainer.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectContainer.Resolve方法的具体用法?C# IObjectContainer.Resolve怎么用?C# IObjectContainer.Resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObjectContainer
的用法示例。
在下文中一共展示了IObjectContainer.Resolve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterCommands
static partial void RegisterCommands(IObjectContainer container)
{
var serviceProvider = container.Resolve<IServiceProvider>();
container.RegisterInstanceAs<MenuCommandHandler>(new DelegateMenuCommandHandler(serviceProvider, container.Resolve<DTE>(),
(_1, _2) => System.Windows.MessageBox.Show("generate skeleton")), SpecFlowCmdSet.GenerateStepDefinitionSkeleton.ToString());
container.RegisterTypeAs<RunScenariosCommand, MenuCommandHandler>(SpecFlowCmdSet.RunScenarios.ToString());
container.RegisterTypeAs<DebugScenariosCommand, MenuCommandHandler>(SpecFlowCmdSet.DebugScenarios.ToString());
container.RegisterTypeAs<ReGenerateAllCommand, MenuCommandHandler>(SpecFlowCmdSet.ReGenerateAll.ToString());
}
示例2: OnData
public override void OnData(IObjectContainer container,AppSocketSession session, AppSocketData data)
{
try
{
container.Resolve<IRawDataService>().Log(session, ByteHelper.ConvertBytesToStringByHex(data.RawData, ","));
}
catch (Exception ex)
{
container.Resolve<ILogger>().Error("记录原始数据错误", ex);
}
}
示例3: OnData
public override void OnData(IObjectContainer container,AppSocketSession session, AppSocketData data)
{
try
{
container.Resolve<IRawDataService>().Log(session, Encoding.UTF8.GetString(data.RawData));
}
catch (Exception ex)
{
container.Resolve<ILogger>().Error("记录原始数据错误", ex);
}
}
示例4: RegisterDefaults
public virtual void RegisterDefaults(IObjectContainer container)
{
var serviceProvider = container.Resolve<IServiceProvider>();
RegisterVsDependencies(container, serviceProvider);
container.RegisterTypeAs<InstallServices, InstallServices>();
container.RegisterTypeAs<VsBrowserGuidanceNotificationService, IGuidanceNotificationService>();
container.RegisterTypeAs<WindowsFileAssociationDetector, IFileAssociationDetector>();
container.RegisterTypeAs<RegistryStatusAccessor, IStatusAccessor>();
container.RegisterTypeAs<IntegrationOptionsProvider, IIntegrationOptionsProvider>();
container.RegisterInstanceAs<IIdeTracer>(VsxHelper.ResolveMefDependency<IVisualStudioTracer>(serviceProvider));
container.RegisterInstanceAs(VsxHelper.ResolveMefDependency<IProjectScopeFactory>(serviceProvider));
container.RegisterTypeAs<TestRunnerEngine, ITestRunnerEngine>();
container.RegisterTypeAs<TestRunnerGatewayProvider, ITestRunnerGatewayProvider>();
container.RegisterTypeAs<MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2010MsTest.ToString());
container.RegisterTypeAs<ReSharper5TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper5.ToString());
container.RegisterTypeAs<ReSharper6TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString());
container.RegisterTypeAs<SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString());
container.RegisterTypeAs<VS2012RunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2012.ToString());
container.RegisterTypeAs<AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString());
container.RegisterTypeAs<StepDefinitionSkeletonProvider, IStepDefinitionSkeletonProvider>();
container.RegisterTypeAs<DefaultSkeletonTemplateProvider, ISkeletonTemplateProvider>();
container.RegisterTypeAs<StepTextAnalyzer, IStepTextAnalyzer>();
RegisterCommands(container);
}
示例5: CreateTestRunner
static internal TestRunner CreateTestRunner(out IObjectContainer container, Action<IObjectContainer> registerMocks = null)
{
container = TestRunContainerBuilder.CreateContainer();
if (registerMocks != null)
registerMocks(container);
return (TestRunner)container.Resolve<ITestRunner>();
}
示例6: OnData
public override void OnData(IObjectContainer container,AppSocketSession session, AppSocketData data)
{
try
{
var log = string.Empty;
if (data.RawData[0] == 0x2a)
{
log = Encoding.ASCII.GetString(data.RawData);
}
else
{
log = ByteHelper.ConvertBytesToStringByHex(data.RawData, ",");
}
container.Resolve<IRawDataService>().Log(session, log);
}
catch (Exception ex)
{
container.Resolve<ILogger>().Error("记录原始数据错误", ex);
}
}
示例7: Initialize
/// <summary>
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
Container = VsContainerBuilder.CreateContainer(this);
OleMenuCommandService menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (menuCommandService != null)
{
foreach (var menuCommandHandler in Container.Resolve<IDictionary<SpecFlowCmdSet, MenuCommandHandler>>())
{
menuCommandHandler.Value.RegisterTo(menuCommandService, menuCommandHandler.Key);
}
}
}
示例8: RegisterDefaults
public virtual void RegisterDefaults(IObjectContainer container)
{
var serviceProvider = container.Resolve<IServiceProvider>();
RegisterVsDependencies(container, serviceProvider);
container.RegisterTypeAs<IntegrationOptionsProvider, IIntegrationOptionsProvider>();
container.RegisterInstanceAs<IIdeTracer>(VsxHelper.ResolveMefDependency<IVisualStudioTracer>(serviceProvider));
container.RegisterInstanceAs(VsxHelper.ResolveMefDependency<IProjectScopeFactory>(serviceProvider));
container.RegisterTypeAs<TestRunnerEngine, ITestRunnerEngine>();
container.RegisterTypeAs<TestRunnerGatewayProvider, ITestRunnerGatewayProvider>();
container.RegisterTypeAs<MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.MsTest.ToString());
container.RegisterTypeAs<ReSharperTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString());
container.RegisterTypeAs<SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString());
container.RegisterTypeAs<AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString());
RegisterCommands(container);
}
示例9: FeatureGeneratorRegistry
public FeatureGeneratorRegistry(IObjectContainer objectContainer)
{
providers = objectContainer.Resolve<IDictionary<string, IFeatureGeneratorProvider>>().OrderBy(item => item.Value.Priority).ToList();
}
示例10: CreateInterceptor
/// <summary>
/// 创建一个可用于缓存的拦截器
/// </summary>
public override IInterceptor CreateInterceptor(IObjectContainer container)
{
var cacheProvider = container.Resolve<ICacheProvider>();
return new CachingInterceptor(this, cacheProvider);
}
示例11: CreateScenarioContainer
public virtual IObjectContainer CreateScenarioContainer(IObjectContainer testThreadContainer, ScenarioInfo scenarioInfo)
{
if (testThreadContainer == null)
throw new ArgumentNullException(nameof(testThreadContainer));
var scenarioContainer = new ObjectContainer(testThreadContainer);
scenarioContainer.RegisterInstanceAs(scenarioInfo);
var contextManager = testThreadContainer.Resolve<IContextManager>();
var featureContext = contextManager.FeatureContext;
if (featureContext != null)
scenarioContainer.RegisterInstanceAs(featureContext);
scenarioContainer.ObjectCreated += obj =>
{
var containerDependentObject = obj as IContainerDependentObject;
if (containerDependentObject != null)
containerDependentObject.SetObjectContainer(scenarioContainer);
};
var runtimePluginEvents = testThreadContainer.Resolve<RuntimePluginEvents>();
runtimePluginEvents.RaiseCustomizeScenarioDependencies(scenarioContainer);
return scenarioContainer;
}
示例12: CreateTestThreadContainer
public virtual IObjectContainer CreateTestThreadContainer(IObjectContainer globalContainer)
{
var testThreadContainer = new ObjectContainer(globalContainer);
defaultDependencyProvider.RegisterTestThreadContainerDefaults(testThreadContainer);
var runtimePluginEvents = globalContainer.Resolve<RuntimePluginEvents>();
runtimePluginEvents.RaiseCustomizeTestThreadDependencies(testThreadContainer);
testThreadContainer.Resolve<IBindingInstanceResolver>();
return testThreadContainer;
}
示例13: CreateTestRunner
internal static TestRunner CreateTestRunner(out IObjectContainer createThreadContainer, Action<IObjectContainer> registerTestThreadMocks = null, Action<IObjectContainer> registerGlobalMocks = null)
{
createThreadContainer = CreateDefaultTestThreadContainer(registerTestThreadMocks: registerTestThreadMocks, registerGlobalMocks: registerGlobalMocks);
return (TestRunner)createThreadContainer.Resolve<ITestRunner>();
}
示例14: CreateTestRunner
public ITestRunnerGateway CreateTestRunner(IObjectContainer container)
{
return container.Resolve<ITestRunnerGateway>(tool.ToString());
}
示例15: BindingFactory
public BindingFactory(IObjectContainer container)
{
this.runtimeConfiguration = container.Resolve<RuntimeConfiguration>();
this.errorProvider = container.Resolve<IErrorProvider>();
}