public HtmlTag Build <T>(Expression <Func <T, object> > prop)
        {
            var req = TagGenerator.BuildRequestData(_requestData.ViewContext, prop);

            req.Accessor = _requestData.Accessor.GetChildAccessor(prop);

            var pipeline = new ConventionPipeline(req, _builders);

            return(pipeline.BuildHtmlTag());
        }
示例#2
0
        private HtmlTag BuildTag(RequestData requestData, List <HtmlConvention> htmlConventions, Func <HtmlConvention, ITagConventions> getTagConvention, Func <HtmlTag> defaultBuilder)
        {
            var builders = new List <Builder>();

            for (int i = htmlConventions.Count - 1; i >= 0; i--)
            {
                var conv = (IConventionAccessor)getTagConvention(htmlConventions[i]);
                for (int j = conv.Builders.Count - 1; j >= 0; j--)
                {
                    builders.Add(conv.Builders[j]);
                }
            }

            var pipeline = new ConventionPipeline(requestData, builders);
            var tag      = pipeline.BuildHtmlTag();

            return(tag ?? defaultBuilder());
        }
        public HtmlTag Build <T>(T value)
        {
            var pipeline = new ConventionPipeline(new ValueRequestData <T>(_requestData, value), _builders);

            return(pipeline.BuildHtmlTagNoPipe());
        }