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


C# IContainerAdapter类代码示例

本文整理汇总了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();
 }
开发者ID:stevehebert,项目名称:IocPerformance,代码行数:7,代码来源:Result.cs

示例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);
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:7,代码来源:BenchmarkRunner.cs

示例3: IndependentServiceRegisteredAsSelf

        public void IndependentServiceRegisteredAsSelf(IContainerAdapter adapter)
        {
            adapter.RegisterType<IndependentService>();
            var component = adapter.Resolve<IndependentService>();

            Assert.NotNull(component);
        }
开发者ID:KallynGowdy,项目名称:net-feature-tests,代码行数:7,代码来源:1_BasicTests.cs

示例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;
 }
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:AboutMenuItem.cs

示例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();
        }
开发者ID:wade,项目名称:IocPerformance,代码行数:28,代码来源:Program.cs

示例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));
                }
            }
        }
开发者ID:vvs0205,项目名称:IocPerformance,代码行数:31,代码来源:Program.cs

示例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;
        }
开发者ID:serbrech,项目名称:IocPerformance,代码行数:34,代码来源:Program.cs

示例8: SettingsTreeView

 public SettingsTreeView(IContainerAdapter container)
 {
     IoCContainer = container;
     ShowNodeToolTips = true;
     HideSelection = false;
     Dock = DockStyle.Fill;
 }
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:SettingsTreeView.cs

示例9: TreeViewComponent

 public TreeViewComponent(IContainerAdapter container)
 {
     IoCContainer = container;
     this.ShowNodeToolTips = true;
     this.HideSelection = false;
     ViewLevel = 50;
 }
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:TreeViewComponent.cs

示例10: MethodToBenchmark

 public override void MethodToBenchmark(IContainerAdapter container)
 {
     container.PrepareBasic();
     container.Resolve(typeof(IDummyOne));
     container.Resolve(typeof(ISingleton1));
     container.Dispose();
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:7,代码来源:12_PrepareAndRegisterAndSimpleResolve_Benchmark.cs

示例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;
 }
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:SaveAllMenuItem.cs

示例12: PropertyDependencyIsOptional

        public void PropertyDependencyIsOptional(IContainerAdapter adapter)
        {
            adapter.RegisterType<ServiceWithSimplePropertyDependency>();
            var component = adapter.Resolve<ServiceWithSimplePropertyDependency>();

            Assert.Null(component.Service);
        }
开发者ID:KallynGowdy,项目名称:net-feature-tests,代码行数:7,代码来源:7_PropertyTests.cs

示例13: OpenGenericTypes

        public void OpenGenericTypes(IContainerAdapter adapter)
        {
            adapter.RegisterTransient(typeof(IGenericService<>), typeof(GenericService<>));
            var resolved = adapter.Resolve<IGenericService<int>>();

            Assert.NotNull(resolved);
        }
开发者ID:KallynGowdy,项目名称:net-feature-tests,代码行数:7,代码来源:3_GenericTests.cs

示例14: SPNodeProvider

        public SPNodeProvider(SPFarm farm, IEnumerable<IRule<ISPNode>> rules, IContainerAdapter container)
        {
            ViewLevel = 100;
            Farm = farm;
            IoCContainer = container;

            _ruleEngine = new FirstAcceptRuleEngine<ISPNode>(rules);
        }
开发者ID:lucaslra,项目名称:SPM,代码行数:8,代码来源:SPNodeProvider.cs

示例15: MainMenuStrip

        public MainMenuStrip(IContainerAdapter container)
        {
            this.TabIndex = 0;

            var items = container.ResolveBind<IMenuItem>(this.GetType());

            this.Items.AddRange(items.Cast<ToolStripItem>().ToArray());
        }
开发者ID:lucaslra,项目名称:SPM,代码行数:8,代码来源:MainMenu.cs


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