Get property parameter by global access:

/// Get property param
/// w ##class().GetPropertyParam("Form.Test.Simple", "Name", "MAXLEN")
ClassMethod GetPropertyParam(class As %Dictionary.CacheClassname = "", property As %String = "", param As %String = "") As %String [ CodeMode = expression ]
{
$$$comMemberArrayGet(class, $$$cCLASSproperty, property, $$$cPROPparameter, param)
}

If it's a File Stream you can set TranslateTable property to your charset before reading.

Otherwise you can use $zcvt function to convert strings.

Here's an example of iterating encodings for $zcvt to determine a correct encoding.

If you are interested in encoding internals use zzdump to check hexdumps.

If your encoding is region specific don't forget to set your locale.

Persistent classes:

SELECT Name
FROM %Dictionary.ClassDefinition_SubclassOf('%Persistent')

List properties and relationships (if you need subset - filter by parent - it's a class):

SELECT
parent,  Name, Cardinality, Collection, Id, _Identity,  Relationship, Type
FROM %Dictionary.CompiledProperty

Foreign keys:

SELECT
parent, Name, Properties, ReferencedClass, ReferencedKey
FROM %Dictionary.ForeignKeyDefinition

For everything %Dictionary.Compiled* - includes defined and inherited values, Definitions include only items defined in a current class.

Add a new Business Host. If you want to add several, call CallProductionUpdateAndSaveToClass method once at the end.

Include Ensemble

Class test.prod
{

Parameter DOMAIN = "Ensemble";

/// Add new Business Host.
/// productionName - name of production class
/// name - name of item you want to add
/// class - class name of the item you want to add
/// w $System.Status.GetErrorText(##class(test.prod).add())
ClassMethod add(productionName As %Dictionary.CacheClassname = "isc.py.test.Production", name As %String = "MyOperation", class As %Dictionary.CacheClassname = "isc.py.ens.Operation")
{
    Set production = ##class(Ens.Config.Production).%OpenId(productionName)
    
    Set item = ##class(Ens.Config.Item).%New()
    Set item.PoolSize = 1
    Set item.Name = name
    Set item.ClassName = class
    Set:item.Name="" item.Name = item.ClassName
    Set item.Enabled = $$$YES
    Set sc = production.Items.Insert(item)
    Quit:$$$ISERR(sc) sc
    Set sc = $$$AuditModifyProductionConfig(production.Name,item.Name,$$$Text("Item added to production using generator in " _ $classname()))
    Quit:$$$ISERR(sc) sc   
    Set sc = ##class(EnsPortal.Template.prodConfigSCPage).CallProductionUpdateAndSaveToClass(production,"","SaveProduction")
    Quit sc
}

}