Sometimes you want to leverage 2sxc to create a solution, provide data input etc. but want to output or re-use the data in your own Module, Skin, Script or something else. This is easy to do.
We enhanced 2sxc fairly recently to include special Constructors giving you all you need - no matter where your initial code started. The scenarios are things like
- Already created Razor scripts (hosted in the Razor host) which should then use some data previously collected in a 2sxc App
- Existing WebForms solutions which need this app data or a Visual Query previously made in 2sxc
- More complex server side mashups which need to merge stuff from multiple tables, 2sxc and various modules
- Existing stuff which you want to extend with 2sxc MetaData (more about that some other post)
Note: if you actually want to render 2sxc content blocks with edit-functionality and everything (instead of working with the data of an App) then you want to read the blog about using the 2sxc instance.
The App Constructor
Basically all you need is to reference the 2sxc DLL and call ToSic.SexyContent.Environment.Dnn7.App(…) and you're good to go. From then on you have an App object (with interface IApp) with properties like