public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            _templates.AllTemplates().Each(t =>
            {
                var context = new AttachRequest
                {
                    Template = t,
                    Logger   = SparkLogger.Default()
                };

                _attachers.Where(a => a.CanAttach(context)).Each(a => a.Attach(context));
            });
        }
Esempio n. 2
0
        private BindRequest createBindRequest(ITemplate template, ITemplateRegistry templateRegistry)
        {
            var chunks = _chunkLoader.Load(template);

            return(new BindRequest
            {
                Target = template,
                Types = _types,
                TemplateRegistry = templateRegistry,
                Master = chunks.Master(),
                ViewModelType = chunks.ViewModel(),
                Namespaces = chunks.Namespaces(),
                Logger = SparkLogger.Default()
            });
        }
        public void Compose(ITemplateRegistry templates)
        {
            templates.AllTemplates().Each(t =>
            {
                var bindRequest = new BindRequest
                {
                    Target           = t,
                    Parsing          = _parsings.ParsingFor(t),
                    Types            = _types,
                    TemplateRegistry = templates,
                    Logger           = SparkLogger.Default()
                };

                var binders  = _binders.Where(x => x.CanBind(bindRequest));
                var policies = _policies.Where(x => x.Matches(t));

                binders.Each(binder => binder.Bind(bindRequest));
                policies.Each(policy => policy.Apply(t));
            });
        }