Erin I have over 20 custom tables in an application and I use a simple method to map the fields across and dynamically create custom table records. You could do this same type of work with a document type. The key is to have the field names the same in your source database and your target (Kentico) database. Take a look at this code. The part that gets the XML with properties from the class is ClassFormDefinition. It doesn't matter if its a custom table or a custom document type, all the "classes" are stored in the cms_class table.
/// <summary>
/// Creates an item for a custom table and dynamically adds the columns data based on the classinfo and row column comparison
/// </summary>
/// <param name="Dci"></param>
/// <param name="Row"></param>
/// <returns></returns>
public static bool CreateCustomTableItem(DataClassInfo Dci, DataRow Row)
{
bool okInsert = false;
// Creates new Custom table item provider
CustomTableItemProvider customTableProvider = new CustomTableItemProvider(ui);
if (Dci == null)
{
throw new Exception("Data class info cannot be null.");
}
else
{
// Creates new custom table item object
CustomTableItem newCustomTableItem = CustomTableItem.New(Dci.ClassName, customTableProvider);
List<string> classProperties = new List<string>();
// get the class definition
var doc = XDocument.Parse(Dci.ClassFormDefinition);
// get a list of all the tables properties by column value
List<string> elements = doc.Descendants("field").Select(el => el.Attribute("column").Value).ToList();
// got the class properties now compare
foreach (string str in elements)
{
// see if the class info contains the column in the data row passed in this method
if (Row.Table.Columns.Contains(str))
{
// contains the column so set a value
newCustomTableItem.SetValue(s, Row[str]);
okInsert = true;
}
}
if (okInsert)
{
// Inserts the custom table item into database
newCustomTableItem.Insert();
}
}
return okInsert;
}
If you don't use this code, no big deal, but definately check out the cms_class.ClassFormDefinition table and field to get your field definitions.