My requirement is to store the result of a "rendered" DCP. With DXA since the views will do the rendering portion, my idea was to get the "DCP" from Broker and then get the corresponding partial view in DXA, render it and then store the resultant string. Here are the steps I have -
Get the Component id as a part of the URL request like -
/devControls/RenderDCP/tcm_x-y
Get the Entity model using the following call -
id = id.Replace("_", ":"); EntityModel model = ContentProvider.GetEntityModel(id, WebRequestContext.Localization);
Render the DCP as a string using custom code -
return Content(RenderPartialToString(model.MvcData.ViewName, model));
Everything looks fine theoretically. However, I am failing in the second step itself. When I debug my code, Item tcm_x-y not found
. However, I see the item in my Broker DB. Any thoughts on how to proceed with this?