blob: cb957a2d3036474030ce2093e82cbb8d0110211a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace System.ComponentModel.Composition.Factories
{
public static partial class CatalogFactory
{
public static AggregateCatalog CreateAggregateCatalog()
{
return new AggregateCatalog();
}
public static AggregateCatalog CreateAggregateCatalog(params ComposablePartCatalog[] catalogs)
{
return new AggregateCatalog(catalogs);
}
public static ComposablePartCatalog Create()
{
return new NoOverridesComposablePartCatalog();
}
public static ComposablePartCatalog Create(params ComposablePart[] parts)
{
var definitions = parts.Select(part => PartDefinitionFactory.Create(part));
return Create(definitions.ToArray());
}
public static ComposablePartCatalog Create(params ComposablePartDefinition[] definitions)
{
return new DerivedComposablePartCatalog(definitions);
}
public static ComposablePartCatalog CreateDefaultAttributed()
{
return CreateAttributed(typeof(CatalogFactory).Assembly);
}
public static ComposablePartCatalog CreateDisposable(Action<bool> disposeCallback)
{
return new DisposableComposablePartCatalog(disposeCallback);
}
public static ComposablePartCatalog CreateAttributed(Assembly assembly)
{
return new AssemblyCatalog(assembly);
}
public static ComposablePartCatalog CreateAttributed(params Type[] types)
{
return new TypeCatalog(types);
}
public static ComposablePartCatalog CreateNonFilteredAttributed(params Type[] types)
{
return new NonFilteringTypeCatalog(types);
}
public static MutableComposablePartCatalog CreateMutable(params ComposablePartDefinition[] definitions)
{
return new MutableComposablePartCatalog(definitions);
}
public static ComposablePartCatalog CreateFiltered(ComposablePartCatalog catalog, Func<ComposablePartDefinition, bool> filter)
{
return new FilteredCatalog(catalog, filter);
}
}
}
|