// For adding a text with an alignment to an in-memory database
// set the working database before using AdjustAlignment
Database prevWorkingDb = HostApplicationServices.WorkingDatabase;
HostApplicationServices.WorkingDatabase = db;
dbText.AdjustAlignment(db);
HostApplicationServices.WorkingDatabase = prevWorkingDb;