예제 #1
0
        public bool CanAttach(IAttachRequest request)
        {
            var descriptor = request.Template.Descriptor as ViewDescriptor;
            var parsing    = _registrations.ParsingFor(request.Template);

            return(descriptor != null &&
                   descriptor.Master == null &&
                   (descriptor.HasViewModel() || parsing.Master.IsNotEmpty()) &&
                   !request.Template.IsPartial() &&
                   parsing.Master != string.Empty);
        }
예제 #2
0
        public bool CanAttach(IAttachRequest <T> request)
        {
            var descriptor = request.Template.Descriptor as ViewDescriptor <T>;
            var parsing    = _parsing.ParsingFor(request.Template);

            return(descriptor != null &&
                   descriptor.Master == null &&
                   (descriptor.HasViewModel() || parsing.Master.IsNotEmpty()) &&
                   !request.Template.IsPartial() &&
                   parsing.Master != string.Empty &&
                   (!descriptor.Name().EqualsIgnoreCase(MasterName) ||
                    (descriptor.Name().EqualsIgnoreCase(MasterName) && parsing.Master != null && !parsing.Master.EqualsIgnoreCase(MasterName))));
        }
        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));
            });
        }