Oh sorry.....will paste together the relevant parts.....
When I run this:
Dim typeName As String = String.Format("Talisman.CorpScorecard.Domain.CollectionClasses.{0}Collection, Talisman.CorpScorecard.Domain", ddlLookupTable.SelectedValue)
Me.llbDataSource.EntityCollectionTypeName = typeName 'Has no effect!!
Because....
public class LLBLGenProDataSourceView : LLBLGenProDataSourceViewBase, IDisposable
public string EntityCollectionTypeName
{
get
{
if(_containedCollection == null)
{
if(this.Owner.DataContainerType == DataSourceDataContainerType.EntityCollection)
{
return base.DataContainerTypeName;
}
else
{
return string.Empty;
}
}
else
{
return FieldUtilities.CreateFullTypeName(_containedCollection.GetType());
}
}
set
{
if(value.Length <= 0)
{
_containedCollection = null;
return;
}
bool differentType = (this.EntityCollectionTypeName != value);
base.DataContainerTypeName = value;
if(differentType)
{
CreateEntityCollectionContainerIfRequired();
}
}
}
private void CreateEntityCollectionContainerIfRequired()
{
// DOES THIS LINE OF CODE MAKE SENSE????:
if(_containedCollection == null)
{
Type typeToCreate = Type.GetType(base.DataContainerTypeName);
if(typeToCreate != null)
{
this.ContainedEntityCollection = (IEntityCollection)Activator.CreateInstance(typeToCreate);
}
}
}
So, imho, the Code:
if(_containedCollection == null)
Seems to me to be a bit of a bug.
bool differentType = (this.EntityCollectionTypeName != value);
If differentType is True, it should always reinstantiate ContainedEntityCollection, regardless if _containedCollection == null or not, because the Type has changed. CreateEntityCollectionContainerIfRequired is assuming no Type change, and if it already has a ContainedEntityCollection, it doesn't reload.
As I workaround, I am manually setting the collection to null to get it to work, but that is unintuitive, the only way I figured out to do it was by looking at the LLB runtime source code.