public static ConnegGraph Build(BehaviorGraph behaviorGraph) { var graph = new ConnegGraph(); TypePool typePool = behaviorGraph.Types(); var writers = typePool .TypesMatching( x => x.Closes(typeof(IMediaWriter <>)) && x.IsConcreteWithDefaultCtor() && !x.IsOpenGeneric()); graph.Writers.AddRange(writers); var readers = typePool .TypesMatching( x => x.Closes(typeof(IReader <>)) && x.IsConcreteWithDefaultCtor() && !x.IsOpenGeneric()); graph.Readers.AddRange(readers); return(graph); }
public void Configure(IServiceRegistry services) { var matchedTypes = _types.TypesMatching(_typeFilters.Matches); _conventions .Each(convention => convention.Register(matchedTypes, services)); }
public void BuildBehaviors(TypePool pool, BehaviorGraph graph) { _graph = graph; pool.TypesMatching(TypeFilters.Matches).Each(scanMethods); _graph = null; }
public IEnumerable <Type> Find() { var list = new List <string> { AppDomain.CurrentDomain.SetupInformation.ApplicationBase }; string binPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath; if (binPath.IsNotEmpty()) { if (Path.IsPathRooted(binPath)) { list.Add(binPath); } else { list.Add(AppDomain.CurrentDomain.SetupInformation.ApplicationBase.AppendPath(binPath)); } } var assemblies = list.SelectMany(x => AssembliesFromPath(x)); var pool = new TypePool(); pool.IgnoreExportTypeFailures = true; pool.AddAssemblies(assemblies); return(pool.TypesMatching(x => x.IsConcreteTypeOf <IApplicationSource>() && x.IsConcreteWithDefaultCtor())); }
public void Configure(BehaviorGraph graph) { _types.TypesMatching(t => t.IsConcreteTypeOf <ISmartGrid>()).Each(t => { buildChain(graph, t); addHarnessToServices(graph, t); }); }
public void BuildBehaviors(TypePool pool, BehaviorGraph graph) { _graph = graph; // Do not do any assembly scanning if no type or method filters are set pool.ShouldScanAssemblies = HasFilters(); pool.TypesMatching(TypeFilters.Matches).Each(scanMethods); _graph = null; }
public IEnumerable<ActionCall> FindActions(TypePool types) { // Do not do any assembly scanning if no type or method filters are set types.ShouldScanAssemblies = HasFilters(); return types .TypesMatching(TypeFilters.Matches) .SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Public) .Select(x => _actionCallProvider(type, x)) .Where(MethodFilters.Matches)); }
public void BuildChains(TypePool pool, CommandGraph graph) { pool .TypesMatching(TypeFilters.Matches) .Each(t => { graph.AddChainForNew(new CommandChain(t)); graph.AddChainForExisting(new CommandChain(t)); }); }
public IEnumerable <IViewToken> FindViews(BehaviorGraph graph) { var types = new TypePool(); types.AddAssemblies(AppDomain.CurrentDomain.GetAssemblies()); types.IgnoreExportTypeFailures = true; return(types.TypesMatching(t => t.IsConcrete() && t.Closes(typeof(FubuHtmlDocument <>)) && !t.Equals(typeof(FubuHtmlDocument <>))) .Select(t => new HtmlDocumentViewToken(t))); }
public void Configure(BehaviorGraph graph) { // This needs to be forced to true here _types.ShouldScanAssemblies = true; _types.TypesMatching(_viewTypeFilter).Each(type => { var chain = graph.AddChain(); var node = _facilities.FirstValue(x => x.CreateViewNode(type)); chain.AddToEnd(node); _configureChain(chain); }); }
IEnumerable <HandlerCall> IHandlerSource.FindCalls() { var types = new TypePool(); if (_assemblies.Any()) { types.AddAssemblies(_assemblies); } else { types.AddAssembly(FubuTransportRegistry.FindTheCallingAssembly()); } return(types.TypesMatching(_typeFilters.Matches).SelectMany(actionsFromType)); }
internal void Apply(SettingRegistry registry, BehaviorGraph graph) { var typePool = new TypePool(); if (_useApplicationAssembly) { typePool.AddAssembly(graph.ApplicationAssembly); } typePool.AddAssemblies(_assemblies); typePool.TypesMatching(_filter) .Where(type => graph.Services.DefaultServiceFor(type) == null) .Each(type => registry.AddSettingType(type)); }
public static IEnumerable <IFubuRegistryExtension> FindAllExtensions() { if (!PackageRegistry.PackageAssemblies.Any()) { return(new IFubuRegistryExtension[0]); } var pool = new TypePool(null); pool.AddAssemblies(PackageRegistry.PackageAssemblies); // Yeah, it really does have to be this way return(pool.TypesMatching( t => hasDefaultCtor(t) && t.GetInterfaces().Any(i => i.FullName == typeof(IFubuRegistryExtension).FullName)) .Select(buildExtension)); }
public static IEnumerable <Type> FindAllExtensionTypes(IEnumerable <Assembly> assemblies) { if (!assemblies.Any()) { return(new Type[0]); } var pool = new TypePool { IgnoreExportTypeFailures = false }; pool.AddAssemblies(assemblies); // Yeah, it really does have to be this way return(pool.TypesMatching( t => hasDefaultCtor(t) && t.GetInterfaces().Any(i => i.FullName == typeof(IFubuRegistryExtension).FullName))); }
public void Configure(FubuRegistry registry) { var types = new TypePool(); types.AddAssemblies(AppDomain.CurrentDomain.GetAssemblies()); types.IgnoreExportTypeFailures = true; // Some ugly Generic trickery types.TypesMatching(IsGridDefinitionType).Each(type => { typeof(Loader <>).CloseAndBuildAs <ILoader>(type).Apply(registry); }); var policies = new ColumnPolicies(); registry.ReplaceSettings(policies); registry.Services(x => x.AddService <IColumnPolicies>(policies)); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { var pool = new TypePool(); pool.AddAssemblies(AppDomain.CurrentDomain.GetAssemblies()); pool.IgnoreExportTypeFailures = true; pool.TypesMatching(type => type.IsConcreteWithDefaultCtor() && type.CanBeCastTo <TopicRegistry>()) .Each(type => { // All we have to do is create it to work Activator.CreateInstance(type); }); TopicGraph.AllTopics.All().Each(node => { node.Url = _urls.UrlFor(node.TopicType); if (!node.Url.StartsWith("/")) { node.Url = "/" + node.Url; // has to be an absolute } }); }
public IEnumerable <IViewToken> FindViews(TypePool types, BehaviorGraph graph) { return(types.TypesMatching(IsWebFormView).Select(x => new WebFormViewToken(x) as IViewToken)); }
public void RegisterBuilders(TypePool pool, IEnumerable<IEntityBuilderRegistrationConvention> conventions, EntityBuilderRegistry registry) { pool .TypesMatching(TypeFilters.Matches) .Each(t => conventions.Each(convention => convention.Process(t, registry))); }
public static IEnumerable <Type> EntityTypes(this TypePool pool) { return((from type in pool.TypesMatching(AwesomeConfiguration.AwesomeEntities) where type.IsConcrete() select type).Distinct()); }
public void BuildChains(TypePool types, ValidationGraph graph) { types .TypesMatching(TypeFilters.Matches) .Each(type => graph.AddChain(ValidationChain.GenericForModel(type))); }
public void EachType(TypePool types, Action<Type> action) { types .TypesMatching(TypeFilters.Matches) .Each(action); }