/// <summary> /// Creates and returns a new IComponentModel instance that supports composition. /// The model will have the exports pre configured public static IComponentModel CreateWithExports(params Export[] exports) { ConfigurableComponentModel model = new ConfigurableComponentModel(); ConfigurableCompositionService svc = new ConfigurableCompositionService(model.container); svc.ExportsToCompose.AddRange(exports); svc.SatisfyImportsOnce((ComposablePart)null); model.DefaultCompositionService = svc; return(model); }
/// <summary> /// Creates and returns a new IComponentModel instance that supports calls /// to DefaultCompositionService.SatisyImportsOnce. /// The supplied composable parts will be used in the composition. /// </summary> public static IComponentModel Create(params object[] composableParts) { ConfigurableComponentModel model = new ConfigurableComponentModel(); ConfigurableCompositionService svc = new ConfigurableCompositionService(model.container); if (composableParts != null) { svc.PartsToCompose.AddRange(composableParts); } model.DefaultCompositionService = svc; return(model); }