Esempio n. 1
0
        public object CreateModel(string viewName, DD4T.ContentModel.IComponentPresentation componentPresentation)
        {
            object model;

            if (TryCreateModel(viewName, componentPresentation, out model))
            {
                return(model);
            }

            throw new ModelNotCreatedException(viewName);
        }
Esempio 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);
        }