Serialize IContent to use in Angular like front technologies

(A self note) A generic service to convert IContent into an Expando Object, ExpandoObject  can be converted into JSON to use in Angular/React components.
Find the code gist https://gist.github.com/khurramkhang/e8d4b9ef093fe30610be986efa352744


Limitations:

  • not supporting multilingual
  • not preparing friendly urls

Comments

  1. I doubt that's something you want to do. Now you're basically taking the model from the database and sending it out to the frontend. Rather, make the viewmodels serializable and populate them with whatever you need. You can of course make generic viewmodelfactories etc, but just serializing the content model is probably not the right way.

    ReplyDelete
    Replies
    1. I appreciate your input and agreed, It all depends on requirements. I just shared my experience, love It or loath It :)

      Delete

Post a Comment

Popular posts from this blog

EPiServer CMS 11 Useful SQL Queries - 1

EPiServer CMS 11 Useful SQL Queries - 2

Strongly Type Models in EPiServer Commerce