Search code examples
dotnetnuke2sxc

In v17.3+, Is There a way to Get Typed from Outside a 2sxc App?


After making good progress adapting to Typed and recently Strongly Typed 2sxc on our in-development and production projects, I am returning to code we use a few times a year where we need access to either Render the output of a module from the DNN Theme, or get access to Data (just one Content Type) from within a DDR Menu Razor Template.

Most of our code examples are from v13+ using either GetScoped or GetService on IRenderService or IDynamicCodeService as is documented here: Use 2sxc Data, Services or Output in Dnn Themes/Skins and Modules.

This still works, but since we've already adapted related code in the project to at least Typed, switching all the way back to the old stuff is at least frustrating and also concerns us because it seems like we may be forced to do rewrites in the near future once IDynamicCode12 is deprecated. We already have helpers/methods written expecting an ITypedItem to be passed in and rewriting these to be compatible with passing in dynamic is... not fun.

So, we have 2 projects in progress, both are already fully up to date and running DNN v9.13.03 and 2sxc v17.06.03+:

Is there a way "from external" to get at least Typed?

Answering the question above is my immediate need, obviously. But I can't help but think-out-loud...

I experimented with various ways to try to access either IAppTyped or get/instantiate a ServiceKit (ServiceKit16), but I just don't know enough and seem to run into stuff marked internal or other confusions.

It would seem like a long-term benefit to 2sxc's future evolutions if:

  1. The ServiceKit concept had a way to get to the modern equivalents of IRenderService and IDynamicCodeService. Or maybe a fully instantiated .App (.OfApp(7) ?) returning IAppTyped or better. I really don't know what is possible or too much work, but I know my use-cases well.
  2. Then provide a way to get the full/latest ServiceKit from outside, external.

Thanks if you read this far!!


Solution

  • I have posted this as an Issue (Feature Request) for the vendor/developer on https://github.com/2sic/2sxc/issues/3355