Ejemplo n.º 1
0
        public PluginGraph()
        {
            _profiles =
                new LightweightCache<string, PluginGraph>(name => new PluginGraph {ProfileName = name, Parent = this});

            ProfileName = "DEFAULT";
            _families = new Cache<Type, PluginFamily>(type =>
            {
                return _policies.FirstValue(x => x.Build(type)) ?? new PluginFamily(type);
            });

            _families.OnAddition = family => family.Owner = this;

            _setterRules = new SetterRules();

            _builders = new Cache<Type, IInstanceBuilder>(type => {
                var plugin = new Plugin(type);
                _setterRules.Configure(plugin);

                return plugin.CreateBuilder();
            });
        }
Ejemplo n.º 2
0
        public PluginGraph()
        {
            _profiles =
                new LightweightCache <string, PluginGraph>(name => new PluginGraph {
                ProfileName = name, Parent = this
            });

            ProfileName = "DEFAULT";
            _families   = new Cache <Type, PluginFamily>(type =>
            {
                return(_policies.FirstValue(x => x.Build(type)) ?? new PluginFamily(type));
            });

            _families.OnAddition = family => family.Owner = this;

            _setterRules = new SetterRules();

            _builders = new Cache <Type, IInstanceBuilder>(type => {
                var plugin = new Plugin(type);
                _setterRules.Configure(plugin);

                return(plugin.CreateBuilder());
            });
        }