Exemple #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;
        }
Exemple #2
0
        public static void Compile(BehaviorGraph graph)
        {
            graph.Settings.Replace(() => {
                return PackageRegistry.Timer.Record("Finding AccessorRules", () => {
                    var rules = new AccessorRules();

                    graph.Types()
                        .TypesMatching(
                            x =>
                                x.CanBeCastTo<IAccessorRulesRegistration>() && x.IsConcreteWithDefaultCtor() &&
                                !x.IsOpenGeneric())
                        .
                        Distinct().Select(x => Activator.CreateInstance(x).As<IAccessorRulesRegistration>())
                        .Each(x => x.AddRules(rules));

                    return rules;
                });


            });
        }
Exemple #3
0
 public ViewTypePool(BehaviorGraph graph)
 {
     _graph = graph;
     _types = graph.Types();
 }