本文整理汇总了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;
}
示例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>() );
}
示例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));
}
示例4: RegisterOpenGeneric
private static void RegisterOpenGeneric(ContainerConfiguration config)
{
config.WithParts(typeof(ImportGeneric<>), typeof(GenericExport<>));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例9: RegisterStandard
private static void RegisterStandard(ContainerConfiguration config)
{
config.WithParts(typeof (Singleton), typeof (Transient), typeof (Combined));
}