Example #1
0
        public static Task<ConnegGraph> Build(BehaviorGraph behaviorGraph)
        {
            var graph = new ConnegGraph();

            var writers = TypeRepository.FindTypes(behaviorGraph.AllAssemblies(),
                TypeClassification.Concretes | TypeClassification.Closed, x => x.Closes(typeof (IMediaWriter<>)))
                .ContinueWith(t => graph.Writers.AddRange(t.Result));

            var readers = TypeRepository.FindTypes(behaviorGraph.AllAssemblies(),
                TypeClassification.Concretes | TypeClassification.Closed, x => x.Closes(typeof(IReader<>)))
                .ContinueWith(t => graph.Readers.AddRange(t.Result));

            return Task.WhenAll(writers, readers).ContinueWith(t => graph);
        }
Example #2
0
        public Task<BehaviorChain[]> BuildChains(BehaviorGraph graph, IPerfTimer timer)
        {
            var types = TypeRepository.FindTypes(graph.AllAssemblies(), TypeClassification.Concretes,
                type => type.CanBeCastTo<Topic>());

            return
                types.ContinueWith(
                    t => { return t.Result.Select(x => new SseTopicChain(x).As<BehaviorChain>()).ToArray(); });
        }
Example #3
0
 public static Task Compile(BehaviorGraph graph, IPerfTimer timer, FubuRegistry registry)
 {
     return TypeRepository.FindTypes(graph.AllAssemblies(),
         TypeClassification.Concretes | TypeClassification.Closed, IsValidationRegistration)
         .ContinueWith(t =>
         {
                 t.Result.Distinct()
                 .Each(type => registry.Services.For(typeof(IValidationRegistration)).Add(type));
         });
 }
        public static Task Compile(BehaviorGraph graph, IPerfTimer timer)
        {
            return TypeRepository.FindTypes(graph.AllAssemblies(),
                TypeClassification.Concretes | TypeClassification.Closed, IsAccessorRule)
                .ContinueWith(t =>
                {
                    var rules = new AccessorRules();
                    t.Result.Distinct()                        
                        .Select(x => Activator.CreateInstance(x).As<IAccessorRulesRegistration>())
                        .Each(x => x.AddRules(rules));

                    graph.Settings.Replace(rules);
                });


        }