I am programmatically creating a LLBLGenProDataSource2 and dynamically setting the EntityFactoryTypeName based on a tablename picked from a dropdownlistbox. After creating this datasource, then I bind it to a Gridview. This code works great. Now, I would like to determine what is the primary key fields of the Entity in the datasource. My code is below:
String SPTN = "";
Array PTN = this.DDLBCodeTables.SelectedValue.Split('_');
foreach (string nm in PTN)
{
string TableName;
string FirstLetter = nm.Substring(0, 1);
TableName = FirstLetter.ToUpper() + nm.Substring(1);
SPTN = SPTN + TableName;
}
string EFTN = "DBASupport.LLBL.DAL.FactoryClasses." + SPTN + "EntityFactory, DBASupport.LLBL.DAL";
datasource = new LLBLGenProDataSource2();
datasource.ID = "ODSRuntime";
datasource.DataContainerType = DataSourceDataContainerType.EntityCollection;
datasource.AdapterTypeName = "DBASupport.LLBL.DAL.DatabaseSpecific.DataAccessAdapter, DBASupport.LLBL.DALDBSpecific";
datasource.EntityFactoryTypeName = EFTN;
PHCodeTable.Controls.Clear();
GVCodeTable = new GridView();
GVCodeTable.EnableViewState=true;
GVCodeTable.AutoGenerateColumns=true;
GVCodeTable.AutoGenerateSelectButton = true;
GVCodeTable.DataSource = datasource;
PHCodeTable.Controls.Add(GVCodeTable);
GVCodeTable.DataBind();
Any ideas how to get the primary key from the datasource?
Thanks....