本文整理汇总了C#中IContainerAdapter类的典型用法代码示例。如果您正苦于以下问题:C# IContainerAdapter类的具体用法?C# IContainerAdapter怎么用?C# IContainerAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IContainerAdapter类属于命名空间,在下文中一共展示了IContainerAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Result
public Result(IContainerAdapter containerAdapter, string name, string version)
{
Name = name;
Version = version;
_containerAdapter = containerAdapter;
containerAdapter.Prepare();
}
示例2: BenchmarkRunner
public BenchmarkRunner(IContainerAdapter container, IBenchmark benchmark)
{
this.container = container;
this.benchmark = benchmark;
this.singlethreadedMeasurer = new SinglethreadedBenchmarkMeasurer(container, benchmark);
this.multithreadedMeasurer = new MultithreadedBenchmarkMeasurer(container, benchmark);
}
示例3: IndependentServiceRegisteredAsSelf
public void IndependentServiceRegisteredAsSelf(IContainerAdapter adapter)
{
adapter.RegisterType<IndependentService>();
var component = adapter.Resolve<IndependentService>();
Assert.NotNull(component);
}
示例4: AboutMenuItem
public AboutMenuItem(IContainerAdapter container, ISPMLocalization local)
{
IoCContainer = container;
Text = local.GetText("Interface_About_Text");
ToolTipText = local.GetText("Interface_About_ToolTip");
Image = global::Keutmann.SharePointManager.Properties.Resources.about;
}
示例5: MeasurePerformance
private static void MeasurePerformance(string name, IContainerAdapter container)
{
CollectMemory();
container.Prepare();
WarmUp(container);
long singletonTime = MeasureSingleton(container);
long transientTime = MeasureTransient(container);
long combinedTime = MeasureCombined(container);
Console.WriteLine(string.Format(
"{0}\t{1}\t\t{2}\t\t{3}\t\t{4}\t\t\t{5}\t\t\t\t{6}",
name + " ".Substring(name.Length - 1),
singletonTime,
transientTime,
combinedTime,
Singleton.Instances,
Transient.Instances,
Combined.Instances));
Singleton.Instances = 0;
Transient.Instances = 0;
Combined.Instances = 0;
container.Dispose();
}
示例6: CheckInstanceProperties
private static void CheckInstanceProperties(IContainerAdapter container)
{
if (Singleton.Instances != 1)
{
throw new Exception("Singleton instance count must be one");
}
if (Transient.Instances < (LoopCount * 2) + 1 || Transient.Instances > (LoopCount * 2) + 4)
{
throw new Exception(
string.Format("Transient count must be between {0} and {1} was {2}", (LoopCount * 2) + 1, (LoopCount * 2) + 4, Transient.Instances));
}
if (Combined.Instances != LoopCount + 1 && Combined.Instances != LoopCount + 2)
{
throw new Exception(string.Format("Combined count must be {0} or {1} was {2}", LoopCount + 1, LoopCount + 2, Combined.Instances));
}
if (Complex.Instances != LoopCount + 1 && Complex.Instances != LoopCount + 2)
{
throw new Exception(string.Format("Complex count must be {0} or {1} was {2}", LoopCount + 1, LoopCount + 2, Complex.Instances));
}
if (container.SupportsInterception)
{
if (Calculator.Instances != LoopCount + 1 && Calculator.Instances != LoopCount + 2)
{
throw new Exception(string.Format("Calculator count must be {0} or {1} was {2}", LoopCount + 1, LoopCount + 2, Calculator.Instances));
}
}
}
示例7: MeasurePerformance
private static Result MeasurePerformance(string name, IContainerAdapter container)
{
CollectMemory();
container.Prepare();
WarmUp(container);
var result = new Result();
result.Name = name;
result.Version = container.Version;
result.SingletonTime = MeasureSingleton(container);
result.TransientTime = MeasureTransient(container);
result.CombinedTime = MeasureCombined(container);
if (container.SupportsInterception)
{
result.InterceptionTime = MeasureProxy(container);
}
result.SingletonInstances = Singleton.Instances;
result.TransientInstances = Transient.Instances;
result.CombinedInstances = Combined.Instances;
result.InterceptionInstances = Calculator.Instances;
Singleton.Instances = 0;
Transient.Instances = 0;
Combined.Instances = 0;
Calculator.Instances = 0;
container.Dispose();
return result;
}
示例8: SettingsTreeView
public SettingsTreeView(IContainerAdapter container)
{
IoCContainer = container;
ShowNodeToolTips = true;
HideSelection = false;
Dock = DockStyle.Fill;
}
示例9: TreeViewComponent
public TreeViewComponent(IContainerAdapter container)
{
IoCContainer = container;
this.ShowNodeToolTips = true;
this.HideSelection = false;
ViewLevel = 50;
}
示例10: MethodToBenchmark
public override void MethodToBenchmark(IContainerAdapter container)
{
container.PrepareBasic();
container.Resolve(typeof(IDummyOne));
container.Resolve(typeof(ISingleton1));
container.Dispose();
}
示例11: SaveAllMenuItem
public SaveAllMenuItem(IContainerAdapter container, ISPMLocalization local)
: base(container)
{
Text = local.GetText("Interface_SaveAll_Text");
ToolTipText = local.GetText("Interface_SaveAll_ToolTip");
Image = global::Keutmann.SharePointManager.Properties.Resources.saveall;
}
示例12: PropertyDependencyIsOptional
public void PropertyDependencyIsOptional(IContainerAdapter adapter)
{
adapter.RegisterType<ServiceWithSimplePropertyDependency>();
var component = adapter.Resolve<ServiceWithSimplePropertyDependency>();
Assert.Null(component.Service);
}
示例13: OpenGenericTypes
public void OpenGenericTypes(IContainerAdapter adapter)
{
adapter.RegisterTransient(typeof(IGenericService<>), typeof(GenericService<>));
var resolved = adapter.Resolve<IGenericService<int>>();
Assert.NotNull(resolved);
}
示例14: SPNodeProvider
public SPNodeProvider(SPFarm farm, IEnumerable<IRule<ISPNode>> rules, IContainerAdapter container)
{
ViewLevel = 100;
Farm = farm;
IoCContainer = container;
_ruleEngine = new FirstAcceptRuleEngine<ISPNode>(rules);
}
示例15: MainMenuStrip
public MainMenuStrip(IContainerAdapter container)
{
this.TabIndex = 0;
var items = container.ResolveBind<IMenuItem>(this.GetType());
this.Items.AddRange(items.Cast<ToolStripItem>().ToArray());
}