Example #1
0
        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;
        }
Example #2
0
        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);
        }
Example #3
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 #4
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);
        }
        public void Configure(BehaviorGraph graph)
        {
            _filters.Each(filter =>
            {
                graph.Behaviors.Where(filter.Filter).ToList().Each(chain =>
                {
                    // TODO -- need to do better config logging here
                    chain.ApplyConneg();
                });
            });

            var connegGraph = new ConnegGraph(graph);

            // TODO -- add some config logging here
            _types
                .TypesMatching(x => x.IsConcreteTypeOf<IResourceRegistration>() && !x.IsOpenGeneric())
                .Each(t => t.Create<IResourceRegistration>().Modify(connegGraph, graph));
        }