I'm working on a SDL Tridion DXA Architecture, where I want to consume data of a published component (not linked to any page). The content structure may be in form of a key/value pair (like publish settings), but I am not allowed to use the Publish Settings because Content Editors are not allowed to edit Publish Settings. Need suggestions on how to proceed with like a DCP or a separate file like Publish Settings (if DXA allows) of any other way to read component data.
You can use the following:
YourModel yourModel = (YourModel)SiteConfiguration.ContentProvider.GetEntityModel(compId + "-" + tempId, WebRequestContext.Localization);
This will retrieve your component presentation and cast it to the model you have. You can put componentID and templateID in publish settings, but this way you can retrieve any DCP you want.
thanks for your reply, I'll work on same and keep you posted.– user2166Apr 9, 2022 at 17:27
Thanks, it works as expected.– user2166Apr 10, 2022 at 1:28
1@user2166 - if that answer helped to fix your issue then please also upvote– Velmurugan ♦Apr 10, 2022 at 11:54