Ejemplo n.º 1
0
        public I Create <I>(DD4T.ContentModel.IPage page)
        {
            IBuilder builder = BuilderFactory.GetBuilder(typeof(I));

            if (builder != null)
            {
                return(builder.Create <I>(page));
            }

            throw new ModelNotCreatedException(typeof(I).Name);
        }
Ejemplo n.º 2
0
        public bool TryCreateModel(string viewName, DD4T.ContentModel.IComponentPresentation componentPresentation, out object model)
        {
            IBuilder builder = BuilderFactory.GetBuilder(viewName);

            if (builder != null)
            {
                var baseBuilder = builder as BuilderBase;
                if (baseBuilder != null)
                {
                    var builderBase = baseBuilder;
                    builderBase.LinkFactory = LinkFactory;
                }

                model = builder.Create <object>(componentPresentation);

                return(true);
            }

            model = null;
            return(false);
        }