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

C# ObjectContainer类代码示例

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

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



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

示例1: ObjectContainerSaveState

 public void ObjectContainerSaveState(ObjectContainer o)
 {
     using (var stream = File.Create("x.ssa"))
     {
         stream.Write(_buffer, 0, 0);
     }
 }
开发者ID:theblackcascade,项目名称:ISP,代码行数:7,代码来源:StateManager.cs


示例2: RegisterDefaults

        public virtual void RegisterDefaults(ObjectContainer container)
        {
            container.RegisterTypeAs<DefaultRuntimeConfigurationProvider, IRuntimeConfigurationProvider>();

            container.RegisterTypeAs<TestRunnerManager, ITestRunnerManager>();

            container.RegisterTypeAs<StepFormatter, IStepFormatter>();
            container.RegisterTypeAs<TestTracer, ITestTracer>();

            container.RegisterTypeAs<DefaultListener, ITraceListener>();
            container.RegisterTypeAs<TraceListenerQueue, ITraceListenerQueue>(); 

            container.RegisterTypeAs<ErrorProvider, IErrorProvider>();
            container.RegisterTypeAs<RuntimeBindingSourceProcessor, IRuntimeBindingSourceProcessor>();
            container.RegisterTypeAs<RuntimeBindingRegistryBuilder, IRuntimeBindingRegistryBuilder>();
            container.RegisterTypeAs<BindingRegistry, IBindingRegistry>();
            container.RegisterTypeAs<BindingFactory, IBindingFactory>();
            container.RegisterTypeAs<StepDefinitionRegexCalculator, IStepDefinitionRegexCalculator>();
            container.RegisterTypeAs<BindingInvoker, IBindingInvoker>();

            container.RegisterTypeAs<StepDefinitionSkeletonProvider, IStepDefinitionSkeletonProvider>();
            container.RegisterTypeAs<DefaultSkeletonTemplateProvider, ISkeletonTemplateProvider>();
            container.RegisterTypeAs<StepTextAnalyzer, IStepTextAnalyzer>();

            container.RegisterTypeAs<RuntimePluginLoader, IRuntimePluginLoader>();

            container.RegisterTypeAs<BindingAssemblyLoader, IBindingAssemblyLoader>();

            RegisterUnitTestProviders(container);
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:30,代码来源:DefaultDependencyProvider.cs


示例3: ContainerShouldThrowExceptionWhenDisposed

        public void ContainerShouldThrowExceptionWhenDisposed()
        {
            var container = new ObjectContainer();
            container.Dispose();

            container.Resolve<IObjectContainer>();
        }
开发者ID:gasparnagy,项目名称:BoDi,代码行数:7,代码来源:DisposeTests.cs


示例4: TestObjectReferenceUpdate

        public void TestObjectReferenceUpdate()
        {
            var nodeContainer = new NodeContainer();
            var instance = new TestObject { Name = "Test" };
            var container = new ObjectContainer { Instance = instance };
            var containerNode = nodeContainer.GetOrCreateNode(container);
            var memberNode = containerNode.Children.First();
            var instanceNode = memberNode.Content.Reference.AsObject.TargetNode;

            // Update to a new instance
            var newInstance = new TestObject { Name = "Test2" };
            memberNode.Content.Update(newInstance);
            Helper.TestMemberContentNode(containerNode, memberNode, container, newInstance, nameof(ObjectContainer.Instance), true);
            Helper.TestNonNullObjectReference(memberNode.Content.Reference, newInstance, false);

            var newInstanceNode = nodeContainer.GetNode(newInstance);
            Helper.TestNonNullObjectReference(memberNode.Content.Reference, newInstanceNode, newInstance);
            Assert.AreNotEqual(instanceNode.Guid, newInstanceNode.Guid);

            // Update to null
            memberNode.Content.Update(null);
            Helper.TestMemberContentNode(containerNode, memberNode, container, null, nameof(ObjectContainer.Instance), true);
            Helper.TestNullObjectReference(memberNode.Content.Reference);

            // Update back to the initial instance
            memberNode.Content.Update(instance);
            Helper.TestMemberContentNode(containerNode, memberNode, container, instance, nameof(ObjectContainer.Instance), true);
            Helper.TestNonNullObjectReference(memberNode.Content.Reference, instanceNode, instance);
        }
开发者ID:cg123,项目名称:xenko,代码行数:29,代码来源:TestReferences.cs


示例5: RegisterDefaults

        public virtual void RegisterDefaults(ObjectContainer container)
        {
            container.RegisterTypeAs<DefaultRuntimeConfigurationProvider, IRuntimeConfigurationProvider>();

            container.RegisterTypeAs<TestRunnerFactory, ITestRunnerFactory>();
            container.RegisterTypeAs<TestRunner, ITestRunner>();
            container.RegisterTypeAs<TestExecutionEngine, ITestExecutionEngine>();
            container.RegisterTypeAs<StepDefinitionMatchService, IStepDefinitionMatchService>();

            container.RegisterTypeAs<StepFormatter, IStepFormatter>();
            container.RegisterTypeAs<TestTracer, ITestTracer>();

            container.RegisterTypeAs<DefaultListener, ITraceListener>();

            container.RegisterTypeAs<ErrorProvider, IErrorProvider>();
            container.RegisterTypeAs<StepArgumentTypeConverter, IStepArgumentTypeConverter>();
            container.RegisterTypeAs<BindingRegistry, IRuntimeBindingRegistryBuilder>();
            container.RegisterTypeAs<BindingRegistry, IBindingRegistry>();
            container.RegisterTypeAs<BindingFactory, IBindingFactory>();
            container.RegisterTypeAs<StepDefinitionRegexCalculator, IStepDefinitionRegexCalculator>();
            container.RegisterTypeAs<BindingInvoker, IBindingInvoker>();

            container.RegisterTypeAs<ContextManager, IContextManager>();

            container.RegisterTypeAs<StepDefinitionSkeletonProviderCS, IStepDefinitionSkeletonProvider>(ProgrammingLanguage.CSharp.ToString());
            container.RegisterTypeAs<StepDefinitionSkeletonProviderVB, IStepDefinitionSkeletonProvider>(ProgrammingLanguage.VB.ToString());

            container.RegisterTypeAs<RuntimePluginLoader, IRuntimePluginLoader>();

            container.RegisterTypeAs<BindingAssemblyLoader, IBindingAssemblyLoader>();

            RegisterUnitTestProviders(container);
        }
开发者ID:kenlefeb,项目名称:SpecFlow,代码行数:33,代码来源:DefaultDependencyProvider.cs


示例6: CreateContainer

        public static IObjectContainer CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings)
        {
            var container = new ObjectContainer();

            RegisterDefaults(container);

            var specFlowConfiguration = container.Resolve<ISpecFlowProjectConfigurationLoader>()
                .LoadConfiguration(configurationHolder);

            if (specFlowConfiguration.GeneratorConfiguration.CustomDependencies != null)
                container.RegisterFromConfiguration(specFlowConfiguration.GeneratorConfiguration.CustomDependencies);

            container.RegisterInstanceAs(specFlowConfiguration);
            container.RegisterInstanceAs(specFlowConfiguration.GeneratorConfiguration);
            container.RegisterInstanceAs(specFlowConfiguration.RuntimeConfiguration);

            var generatorInfo = container.Resolve<IGeneratorInfoProvider>().GetGeneratorInfo();
            container.RegisterInstanceAs(generatorInfo);

            container.RegisterInstanceAs(projectSettings);

            container.RegisterInstanceAs(container.Resolve<CodeDomHelper>(projectSettings.ProjectPlatformSettings.Language));

            if (specFlowConfiguration.GeneratorConfiguration.GeneratorUnitTestProvider != null)
                container.RegisterInstanceAs(container.Resolve<IUnitTestGeneratorProvider>(specFlowConfiguration.GeneratorConfiguration.GeneratorUnitTestProvider));

            return container;
        }
开发者ID:ChrisEdwards,项目名称:SpecFlow,代码行数:28,代码来源:GeneratorContainerBuilder.cs


示例7: ObjectInfo

 /* CONSTRUCTOR */
 public ObjectInfo (ObjectContainer container)
 {
         Container = container;
         Depends = container.Depends.ToArray ();
         SystemType = container.SystemType;
         RefId = container.RefId;
 }
开发者ID:sslab-gatech,项目名称:juxta,代码行数:8,代码来源:test.cs


示例8: Init

		public override void Init()
		{
			base.Init();

			_box = (BeerBox) Container["beer.box"];

			_objContainer = (ObjectContainer)Container[typeof(ObjectContainer)];
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:TransactionalTestCase.cs


示例9: Serialize

 public void Serialize(ObjectContainer o)
 {
     var formatter = new BinaryFormatter();
     using (var stream = File.Create("x.dat"))
     {
         formatter.Serialize(stream, o);
     }
 }
开发者ID:theblackcascade,项目名称:ISP,代码行数:8,代码来源:StateManager.cs


示例10: ShouldNotRegisterInvalidTypeMapping

        public void ShouldNotRegisterInvalidTypeMapping()
        {
            // given
            var container = new ObjectContainer();

            // then
            Assert.Catch<InvalidOperationException>(() => container.RegisterTypeAs(typeof(SimpleClassExtendingGenericInterface), typeof(IGenericInterface<>)));
        }
开发者ID:gasparnagy,项目名称:BoDi,代码行数:8,代码来源:RegisterTypeTests.cs


示例11: RegisterDefaults

 private static void RegisterDefaults(ObjectContainer container)
 {
     container.RegisterTypeAs<SpecFlowProjectConfigurationLoader, ISpecFlowProjectConfigurationLoader>();
     container.RegisterTypeAs<InProcGeneratorInfoProvider, IGeneratorInfoProvider>();
     container.RegisterTypeAs<TestGenerator, ITestGenerator>();
     container.RegisterTypeAs<TestHeaderWriter, ITestHeaderWriter>();
     container.RegisterTypeAs<TestUpToDateChecker, ITestUpToDateChecker>();
 }
开发者ID:roffster,项目名称:SpecFlow,代码行数:8,代码来源:GeneratorContainerBuilder.cs


示例12: CreateTestRunnerContainer

        public IObjectContainer CreateTestRunnerContainer(IObjectContainer globalContainer)
        {
            var testRunnerContainer = new ObjectContainer(globalContainer);

            defaultDependencyProvider.RegisterTestRunnerDefaults(testRunnerContainer);

            return testRunnerContainer;
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:8,代码来源:TestRunContainerBuilder.cs


示例13: SetUp

 public void SetUp()
 {
     mockTestRunner = MockRepository.GenerateMock<ITestRunner>();
     var container = new ObjectContainer();
     container.RegisterInstanceAs(mockTestRunner);
     steps = new StepsTestableHelper();
     ((IContainerDependentObject)steps).SetObjectContainer(container);
 }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:8,代码来源:StepsTest.cs


示例14: DisplayValue

        private static string DisplayValue(Tk5FieldInfoEx field, ObjectContainer container, bool showHint)
        {
            TkDebug.AssertArgumentNull(field, "field", null);

            //if (field.Upload != null)
            //    return DisplayUpload(field, row);

            object receiver = container.MainObject;
            string displayValue = string.Empty;
            string value = string.Empty;
            try
            {
                value = receiver.MemberValue(field.NickName).ConvertToString();
                if (field.Decoder == null || field.Decoder.Type == DecoderType.None)
                    displayValue = FormatNumber(field, field.NickName, receiver);
                else
                    displayValue = container.Decoder.GetNameString(field.NickName);
            }
            catch
            {
                displayValue = value;
            }
            if (showHint)
            {
                if (!string.IsNullOrEmpty(field.Hint))
                    displayValue += " " + field.Hint;
            }
            if (field.ListDetail != null && field.ListDetail.Link != null)
            {
                var link = field.ListDetail.Link;
                string linkUrl = string.Empty;
                string target = string.Empty;
                switch (link.RefType)
                {
                    case LinkRefType.Href:
                        linkUrl = HtmlUtil.ParseLinkUrl(receiver, link.Content);
                        linkUrl = WebUtil.ResolveUrl(linkUrl);
                        if (!string.IsNullOrEmpty(link.Base))
                            linkUrl = UriUtil.CombineUri(link.Base, linkUrl).ToString();
                        if (!string.IsNullOrEmpty(link.Target))
                            target = string.Format(ObjectUtil.SysCulture, " target=\"{0}\"", link.Target);
                        break;
                    case LinkRefType.Http:
                        if (!value.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                            linkUrl = "http://";
                        linkUrl += value;
                        target = " target=\"_blank\"";
                        break;
                    case LinkRefType.Email:
                        linkUrl = "mailto:" + value;
                        target = " target=\"_blank\"";
                        break;
                }
                return string.Format(ObjectUtil.SysCulture, "<a href=\"{0}\"{1}>{2}</a>",
                    StringUtil.EscapeHtmlAttribute(linkUrl), target, StringUtil.EscapeHtml(displayValue));
            }
            return displayValue;
        }
开发者ID:ZLLselfRedeem,项目名称:zllinmitu,代码行数:58,代码来源:HtmlExtension_Object.cs


示例15: LoadPlugins

        private static IGeneratorPlugin[] LoadPlugins(ObjectContainer container, IGeneratorConfigurationProvider configurationProvider, SpecFlowConfigurationHolder configurationHolder)
        {
            var plugins = container.Resolve<IDictionary<string, IGeneratorPlugin>>().Values.AsEnumerable();

            var pluginLoader = container.Resolve<IGeneratorPluginLoader>();
            plugins = plugins.Concat(configurationProvider.GetPlugins(configurationHolder).Where(pd => (pd.Type & PluginType.Generator) != 0).Select(pd => LoadPlugin(pluginLoader, pd)));

            return plugins.ToArray();
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:9,代码来源:GeneratorContainerBuilder.cs


示例16: RegisterUnitTestProviders

 partial void RegisterUnitTestProviders(ObjectContainer container)
 {
     container.RegisterTypeAs<NUnitRuntimeProvider, IUnitTestRuntimeProvider>("nunit");
     container.RegisterTypeAs<MbUnitRuntimeProvider, IUnitTestRuntimeProvider>("mbunit");
     container.RegisterTypeAs<MbUnit3RuntimeProvider, IUnitTestRuntimeProvider>("mbunit.3");
     container.RegisterTypeAs<XUnitRuntimeProvider, IUnitTestRuntimeProvider>("xunit");
     container.RegisterTypeAs<MsTestRuntimeProvider, IUnitTestRuntimeProvider>("mstest");
     container.RegisterTypeAs<MsTest2010RuntimeProvider, IUnitTestRuntimeProvider>("mstest.2010");
 }
开发者ID:ChrisEdwards,项目名称:SpecFlow,代码行数:9,代码来源:UnitTestProviders.cs


示例17: NamedRegistrationShouldNotInflucenceNormalRegistrations

        public void NamedRegistrationShouldNotInflucenceNormalRegistrations()
        {
            var container = new ObjectContainer();
            container.RegisterTypeAs<VerySimpleClass, IInterface1>("a_name");

            // when

            container.Resolve<IInterface1>();
        }
开发者ID:gasparnagy,项目名称:BoDi,代码行数:9,代码来源:NamedRegistrationTests.cs


示例18: TransformManager

 public TransformManager(GameEditor edit)
 {
     ma = new MoveArrows();
     rc = new RotateCircles();
     editor = edit;
     currentState = TransformManagerState.select;
     activeObject = new ObjectContainer();
     GameEngine.renderController.setSelect();
 }
开发者ID:KatekovAnton,项目名称:ResourceCollector,代码行数:9,代码来源:TransformManager.cs


示例19: RegisterSingletonObject

 public void RegisterSingletonObject()
 {
     ObjectContainer locator = new ObjectContainer();
     locator.RegisterSingleton<object>(c => { return new object(); });
     var result = locator.Create<object>();
     Assert.IsAssignableFrom<object>(result);
     var result2 = locator.Create<object>();
     Assert.AreSame(result, result2);
 }
开发者ID:joshrivers,项目名称:FreeSWITCH.Managed,代码行数:9,代码来源:ObjectContainerTests.cs


示例20: ShouldNotBeAbleToResolveStructsWithoutCtor

        public void ShouldNotBeAbleToResolveStructsWithoutCtor()
        {
            // given
            var container = new ObjectContainer();

            // when

            container.Resolve<MyStructWithoutCtor>();
        }
开发者ID:gasparnagy,项目名称:BoDi,代码行数:9,代码来源:ResolveTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ObjectContent类代码示例发布时间:2022-05-24
下一篇:
C# ObjectConstructor类代码示例发布时间: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