private void CreateTablesFromXDocument(XDocument xml) { var userTables = xml.Descendants(@"UserTable"); foreach (var userTable in userTables) { var table = (UserTablesMD)company.GetBusinessObject(BoObjectTypes.oUserTables); var adapter = new UserTableAdapter(table, userTable); adapter.Execute(); var addUserTable = new AddUserTable(company, table); addUserTable.Error += OnAddUserTableError; addUserTable.Execute(); } }
/// <summary> /// Creates the table. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> private string CreateTable(Type type) { var table = (UserTablesMD)company.GetBusinessObject(BoObjectTypes.oUserTables); var adapter = new TypeUserTableAdapter(type, table); adapter.Execute(); // used to return the table name, because the AddUserTable action will release the table // thus we won't have access to the table.TableName anymore var tableName = table.TableName; var addUserTable = new AddUserTable(company, table); addUserTable.Error += OnAddUserTableError; addUserTable.Execute(); return(tableName); }