• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IContainerAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IContainerAdapter的典型用法代码示例。如果您正苦于以下问题:C# IContainerAdapter类的具体用法?C# IContainerAdapter怎么用?C# IContainerAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IContainerAdapter类属于命名空间,在下文中一共展示了IContainerAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: PropertyDependencyDoesNotNeedCustomAttribute

        public void PropertyDependencyDoesNotNeedCustomAttribute(IContainerAdapter adapter)
        {
            var property = typeof(ServiceWithSimplePropertyDependency).GetProperty("Service");
            var attributes = property.GetCustomAttributes(false);
            var attributesFromThisFramework = attributes.Where(a => a.GetType().Assembly == adapter.Assembly);

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


示例17: SingletonLifetime

        public void SingletonLifetime(IContainerAdapter adapter)
        {
            adapter.RegisterSingleton<IService, IndependentService>();
            var instance1 = adapter.Resolve<IService>();
            var instance2 = adapter.Resolve<IService>();

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


示例18: AddAdapter

        /// <summary>
        /// Adds an adapter for serving
        /// </summary>
        /// <param name="key">The adapter key</param>
        /// <param name="adapter">The adapter</param>
        public void AddAdapter(string key, IContainerAdapter adapter)
        {
            if (adapters.ContainsKey(key))
            {
                throw new InvalidDataException("An adapter has already been registered with this key");
            }

            adapters.Add(key, adapter);
        }
开发者ID:Kriskit,项目名称:Agnostic-Ioc,代码行数:14,代码来源:ContainerAdapterAccessor.cs


示例19: TimerServiceValidator

        public TimerServiceValidator(IContainerAdapter container)
            : base()
        {
            IoCContainer = container;

            this.QuestionString = "The application needs to run on a frontend server with SharePoint Foundation installed";
            this.SuccessString = "Microsoft SharePoint Timer Service found";
            this.ErrorString = "Microsoft SharePoint Timer Service missing";
        }
开发者ID:lucaslra,项目名称:SPM,代码行数:9,代码来源:TimerServiceValidator.cs


示例20: MissingPrimitive

        public void MissingPrimitive(IContainerAdapter adapter)
        {
            adapter.RegisterType<IService, IndependentService>();
            adapter.RegisterType<ServiceWithDependencyAndOptionalInt32Parameter>();

            var component = adapter.Resolve<ServiceWithDependencyAndOptionalInt32Parameter>();

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IContainerOwner类代码示例发布时间:2022-05-24
下一篇:
C# IContainer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap