Table of Contents

Convention: Proxy and Real Controllers

Tip

This convention is not relevant for App developers. So if your focus is App Razor or App WebAPIs, you don't need this.

It's meant for people who integrate 2sxc/EAV into another system.

EAV and 2sxc have about 30 WebAPI Controllers which must work on every platform (Dnn/Oqtane) and custom integrations.

To keep code maintenance low, we have a setup with Real controllers and Proxy Controllers which just serve as the entry-point in each platform. Here's how it works:

  1. The code which actually does work is called the Real controller and it's code is in ToSic.Sxc.WebApi or ToSic.Eav.WebApi
  2. The platform has the surface Proxy controller which just ensures that the endpoint is available on that platform
Note

This concept is still being developed in v13 so it's not final.

As of 2022-02 it's only been implemented for ca. 4 controllers, the others are still not fully migrated into this model.

The Real Controller

The real controller is responsible for doing all the work, getting all the dependencies etc. It must be programmed in a way that the Proxies have as little code as possible.

As of 2022-02, they are all named ...ControllerReal to better identify them. Once all controllers are built this way, they will probably be renamed just to ...Controller

The Proxy Controller

Each platform and integration will just have the minimal Proxy Controller which has the following functions:

  1. Make the endpoint available on this platform, on the correct address
  2. Ensure basic endpoint security as the platform does it (like ensure authentication, etc.)
  3. Forward all calls to the Real controller
  4. In rare cases, convert data which is treated differently on that platform to the format the Real Controller expects.

History

  • Introduced in v13

Shortlink: https://go.2sxc.org/proxy-controllers