How to obtain Tables from Model

Unofficial Content

To get the Tables from the KBModel do the following:

// Sample by Forum

using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Artech.Architecture.Common.Objects;
using Artech.Packages.Genexus.Common.Objects;
using Artech.Packages.Genexus.Common.Services;
using Artech.Udm.Framework;
namespace Foo
{
	public class Bar
	{
		public static void ProcessTables()
		{
			EntityKey modelKey = KnowledgeBase.KB.DesignModel.Key;
			ProcessTables(modelKey);
			modelKey = KnowledgeBase.KB.WorkingModel.Key;
			ProcessTables(modelKey);
		}
		public static void ProcessTables(EntityKey modelKey)
		{ 
			StringBuilder builder = new StringBuilder();
			foreach (Table table in BLServices.Tables.GetTables(modelKey))
			{ 
				builder.AppendLine(table.Name);
			} 
			MessageBox.Show(builder.ToString());
		} 
	}
}