Problem appears to be in the base code generated. I looked through it and could not find anywhere that it was checking for design mode.
I took an Entity that only had one relationship. Dropped it on the report and got the error. I then did an override on the related field with:
public override Company.DAL.CollectionClasses.SomeEntityCollection SomeEntity
{
get {
if (!base.InDesignMode)
return GetMultiSomeEntity(false);
else
return null;
}
}
This corrects the problem and the component drops on the design surface without error!
In anticipation of what this fix might be, I modified the first line to include the !base.InDesignMode in these two methods in entityInclude.template.
OneToMany...
public virtual <[RootNamespace]>.CollectionClasses.<[RelatedEntityName]>Collection GetMulti<[MappedFieldNameRelation]>(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
{
if( (!_alreadyFetched<[MappedFieldNameRelation]> || forceFetch || _alwaysFetch<[MappedFieldNameRelation]>) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
and
ManyToMany...
public <[RootNamespace]>.CollectionClasses.<[RelatedEntityName]>Collection GetMulti<[MappedFieldNameRelation]>(bool forceFetch, IEntityFactory entityFactoryToUse)
{
if( ( !_alreadyFetched<[MappedFieldNameRelation]> || forceFetch || _alwaysFetch<[MappedFieldNameRelation]>) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
After regenerating, everything works great as far as this is concerned.
If it is indeed this simple, is this a change you can make to the templates (or an equivalent change where it needs to go)?