menu
Logo
  • Why azing?
  • Blog
  • Help
ENarrow_drop_down
  • DE
  • EN
Suche in Checklisten
search
azing Logo ENarrow_drop_down
  • DE
  • EN
  • Why azing?
  • Help
2sxc
drive_folder_upload
  • homeChecklist Templates
  • south
  • fiber_manual_recordPro: Develop with 2sxc (Apps, Content-Types, Templates, etc.)
  • south

folder_sharedPolyfills - Using newer Apps in Older Versions of 2sxc

  • homeChecklist Templates
  • south
  • fiber_manual_recordPro: Develop with 2sxc (Apps, Content-Types, Templates, etc.)
  • south

folder_sharedPolyfills - Using newer Apps in Older Versions of 2sxc

Folders and checklists

  • check_circlePolymorph API (before v9.35)
  • check_circleSharedCode (before v10.01)

Parts (0) expand_more

These are small document-parts which are used in other documents. They are not a starting point for any real activity. Because of this, they will be listed further down and the search will not list them unless requested. 

SharedCode is a feature in 2sxc 10.01 and compiles a CSharp file for sharing code across apps. This polyfill implement only parts of what SharedCode does, but it should suffice for most use cases. 

Usually you'll see code ca. like this:

var someObject = SharedCode("MyThing.cs");

This simply compiles the CSharp and returns the object. It assumes that this file contains a class called MyThing. As a polyfill, add this function:

private dynamic InstantiateClass(string name){
	var fileName = name + ".cs";
	var path = System.IO.Path.Combine("~", App.Path, getEdition() , "api/Parts", fileName);
	var assembly = BuildManager.GetCompiledAssembly(path);
var compiledType = assembly.GetType(name, true, true);

	object objectValue = null;
	if (compiledType != null)
	{
		objectValue = RuntimeHelpers.GetObjectValue(Activator.CreateInstance(compiledType));
		return ((dynamic)objectValue);
	}
	throw new Exception("Error while creating class instance.");
}

Then call it using something like:

var someObject = CreateInstance("MyThing")

Note that this polyfill doesn't do everything SharedCode does - for example, it doesn't add object of the current context like App, Dnn etc. to the other class. 

Logo
Legal | Content Copyright CC-BY 4.0
bug_reportReport Bug
  • info
  • Links
  • Permissions
code Share
code
URL copied to clipboard.
Embed Checklist close
Copy Copy
Content Copyright

CC-BY 4.0

Translations

None

2sxc - Content Management for DNN & Oqtane Logo

2sxc - Content Management for DNN & Oqtane

QR-Code
azing.org/2sxc/r/-J8tk5fu
View & Use

Public (can be used by everybody)

Edit & Admin

Default (all members can edit)

This catalog has a simple permission model, where all members have the same permissions. For advanced permissions, upgrade to Enterprise.

Here you can see how this document is used and linked by other documents

Used in (0)

Others referencing this

Uses these (0)

Documents linked from this document

How it Behaves

How this document is categorized changes how it behaves.

This is a main document, it is listed normally and appears in search result.

Type

This is a Checklist. Lists are converted into checkboxes.

Get something to say?

Comment to start a discussion or make a note
send

please log on to chat

close

Durchsuche ganz Azing