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


C# ContainerConfiguration.WithParts方法代码示例

本文整理汇总了C#中ContainerConfiguration.WithParts方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerConfiguration.WithParts方法的具体用法?C# ContainerConfiguration.WithParts怎么用?C# ContainerConfiguration.WithParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContainerConfiguration的用法示例。


在下文中一共展示了ContainerConfiguration.WithParts方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

		public override ContainerConfiguration Get( ContainerConfiguration parameter )
		{
			var mappings = source();
			var builder = new ConventionBuilder();
			foreach ( var mapping in mappings )
			{
				builder.ForType( mapping.Subject ).Export( conventionBuilder => conventionBuilder.AsContractType( mapping.ExportAs ?? mapping.Subject ) );	
			}
			var subjects = mappings.Select( mapping => mapping.Subject );
			var result = parameter.WithParts( subjects, builder );
			return result;
		}
开发者ID:DevelopersWin,项目名称:VoteReporter,代码行数:12,代码来源:ExportMappingConfigurator.cs

示例2: BasicConvention

		public void BasicConvention( ContainerConfiguration configuration, ConventionBuilder sut )
		{
			sut.ForTypesMatching( DragonSpark.Specifications.Common.Always.IsSatisfiedBy ).Export();
			var types = this.Adapt().WithNested();
			var container = configuration.WithParts( types, sut ).CreateContainer();
			var export = container.GetExport<SomeExport>();
			Assert.NotNull( export );
			Assert.NotSame( export, container.GetExport<SomeExport>() );

			var invalid = container.TryGet<Item>();
			Assert.Null( invalid );

			var shared = container.GetExport<SharedExport>();
			Assert.NotNull( shared );
			Assert.Same( shared, container.GetExport<SharedExport>() );
		}
开发者ID:DevelopersWin,项目名称:VoteReporter,代码行数:16,代码来源:ConventionBuilderTests.cs

示例3: RegisterMultiple

 private static void RegisterMultiple(ContainerConfiguration config)
 {
     config.WithParts(
         typeof(SimpleAdapterOne),
         typeof(SimpleAdapterTwo),
         typeof(SimpleAdapterThree),
         typeof(SimpleAdapterFour),
         typeof(SimpleAdapterFive),
         typeof(ImportMultiple1),
         typeof(ImportMultiple2),
         typeof(ImportMultiple3));
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:12,代码来源:Mef2ContainerAdapter.cs

示例4: RegisterOpenGeneric

 private static void RegisterOpenGeneric(ContainerConfiguration config)
 {
     config.WithParts(typeof(ImportGeneric<>), typeof(GenericExport<>));
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:4,代码来源:Mef2ContainerAdapter.cs

示例5: RegisterDummies

 private static void RegisterDummies(ContainerConfiguration config)
 {
     config.WithParts(
         typeof(DummyOne),
         typeof(DummyTwo),
         typeof(DummyThree),
         typeof(DummyFour),
         typeof(DummyFive),
         typeof(DummySix),
         typeof(DummySeven),
         typeof(DummyEight),
         typeof(DummyNine),
         typeof(DummyTen));
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:14,代码来源:Mef2ContainerAdapter.cs

示例6: RegisterStandard

 private static void RegisterStandard(ContainerConfiguration config)
 {
     config.WithParts(
         typeof(Singleton1),
         typeof(Singleton2),
         typeof(Singleton3),
         typeof(Transient1),
         typeof(Transient2),
         typeof(Transient3),
         typeof(Combined1),
         typeof(Combined2),
         typeof(Combined3));
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:13,代码来源:Mef2ContainerAdapter.cs

示例7: RegisterComplexObject

 private static void RegisterComplexObject(ContainerConfiguration config)
 {
     config.WithParts(
         typeof(FirstService),
         typeof(SecondService),
         typeof(ThirdService),
         typeof(SubObjectOne),
         typeof(SubObjectTwo),
         typeof(SubObjectThree),
         typeof(Complex1),
         typeof(Complex2),
         typeof(Complex3));
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:13,代码来源:Mef2ContainerAdapter.cs

示例8: RegisterPropertyInjection

 private static void RegisterPropertyInjection(ContainerConfiguration config)
 {
     config.WithParts(
         typeof(ComplexPropertyObject1),
         typeof(ComplexPropertyObject2),
         typeof(ComplexPropertyObject3),
         typeof(ServiceA),
         typeof(ServiceB),
         typeof(ServiceC),
         typeof(SubObjectA),
         typeof(SubObjectB),
         typeof(SubObjectC));
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:13,代码来源:Mef2ContainerAdapter.cs

示例9: RegisterStandard

 private static void RegisterStandard(ContainerConfiguration config)
 {
     config.WithParts(typeof (Singleton), typeof (Transient), typeof (Combined));
 }
开发者ID:pgatilov,项目名称:IocPerformance,代码行数:4,代码来源:Mef2ContainerAdapter.cs


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