0
votes

In some contexts, entities are common to a group of apps. For example, I use a list of departments in my institution for at least 4 apps (different projects that cannot and should not be merged in a single app). Another example is the type of employes or even the list of employees.

Is it possible to create an entity accessible to every app in an easy and fast way?

I searched it, but can't find any documentation about this.

Is it related to the dotnet external use?

// the app id
var appId = 42;
// create a simple app object to then access datavar appSimple =
ToSic.SexyContent.Environment.Dnn7.Factory.App(appId);
// example getting all data of content type Tagvar tags =
appSimple.Data["Tag"];
1
Could you just clarify a few things: a) you just need this in other apps (not non-2sxc razor) and b) you need it in a visual query, json or just a razor output? - iJungleBoy
Just other 2sxc apps, with razor. - João Gomes

1 Answers

1
votes

If you are working with razor and just want to access the data in code, you can create an AppDataSource and tell it what App you need. Here's some Pseudo-code:

var otherApp = CreateSource<AppDataSource>();

otherApp.ZoneId = 74;
otherApp.AppId = 203;

// do this after setting the values
var categories = otherApp.Data["Categories"];