I have no idea why this is happening
I have the following code, and it only seems to happen with this entity type:
public PromotionLine AddProduct(Product product)
{
var promotionLine = new PromotionLine
{
PromotionId = PromotionId,
PromotionLinkType = (byte)PromotionLinkType.Product,
LinkId = product.ProductId
};
EntityManager.AddEntity(promotionLine);
return promotionLine;
}
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at IdeaBlade.EntityModel.EntityKey.ConvertValues()
at IdeaBlade.EntityModel.EntityGroup.FindEntityWrapper(EntityKey entityKey, Boolean includeDeleted)
at IdeaBlade.EntityModel.EntityManager.FindEntityWrapper(EntityKey entityKey, Boolean includeDeleted)
at IdeaBlade.EntityModel.ScalarEntityReference`1.FindToEntity()
at IdeaBlade.EntityModel.ScalarEntityReference`1.FixupReferences()
at IdeaBlade.EntityModel.EntityAspect.<FixupReferences>b__19(EntityReferenceBase eref)
at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
at IdeaBlade.EntityModel.EntityAspect.FixupReferences()
at IdeaBlade.EntityModel.EntityAspect.TrackChanged(EntityChangedEventArgs e)
at IdeaBlade.EntityModel.EntityGroup.OnEntityChanged(EntityChangedEventArgs e)
at IdeaBlade.EntityModel.EntityGroup.AddAttachedEntity(EntityAspect wrapper, EntityState entityState)
at IdeaBlade.EntityModel.EntityManager.AttachEntityAspect(EntityAspect aspect, EntityState entityState)
at IdeaBlade.EntityModel.EntityManager.AttachEntity(Object entity, EntityState entityState)
at IdeaBlade.EntityModel.EntityManager.AddEntity(Object entity)
Even just doing this errors:
var promotionLine = new PromotionLine();
EntityManager.AddEntity(promotionLine);
This is the ctor:
internal PromotionLine()
{
PromotionLineId = Guid.NewGuid();
}
Any clues?
Edited by smi-mark - 21-Oct-2011 at 8:15pm