public object CreateModel(string viewName, DD4T.ContentModel.IComponentPresentation componentPresentation) { object model; if (TryCreateModel(viewName, componentPresentation, out model)) { return(model); } throw new ModelNotCreatedException(viewName); }
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); }