Print Page | Close Window

Error with added association in edmx

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2069
Printed Date: 21-Apr-2026 at 11:51pm


Topic: Error with added association in edmx
Posted By: jsobell
Subject: Error with added association in edmx
Date Posted: 16-Aug-2010 at 10:54pm
I've just converted a Linq2SQL project to DF (and yes, I recreated the edmx from scratch), but when calling queries to load in a snapshot of data I get the error shown below.
The issue appears when I add an association 1-* between a table and a view, and while this works in Linq2SQL (and worked in LLBLGen before that) I can't get it to work in DF due to what appears to be a data error.
Removing the association removes the error, but why an index out of range error???
I'm a bit stuck here, any ideas what might be going on?


{System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at IdeaBlade.EntityModel.Entity.GetValueRaw(DataEntityProperty property, EntityVersion version)
   at IdeaBlade.EntityModel.EntityWrapper.GetValueRaw(DataEntityProperty property)
   at IdeaBlade.EntityModel.EntityWrapper.<GetValuesRaw>b__9(DataEntityProperty p)
   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at IdeaBlade.EntityModel.EntityWrapper.GetValuesRaw(IEnumerable`1 properties)
   at IdeaBlade.EntityModel.EntityWrapper.FindRelatedWrappers(EntityRelationLink relationLink, Boolean includeDeleted)
   at IdeaBlade.EntityModel.EntityWrapper.FindRelatedWrapper(EntityRelationLink relationLink, Boolean includeDeleted)
   at IdeaBlade.EntityModel.ScalarEntityReference`1.FindToEntity()
   at IdeaBlade.EntityModel.ScalarEntityReference`1.FixupReferences()
   at IdeaBlade.EntityModel.EntityWrapper.<FixupReferences>b__13(EntityReferenceBase eref)
   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
   at IdeaBlade.EntityModel.EntityWrapper.FixupReferences()
   at IdeaBlade.EntityModel.EntityWrapper.TrackChanged(EntityChangedEventArgs e)
   at IdeaBlade.EntityModel.EntityGroup.OnEntityChanged(EntityChangedEventArgs e)
   at IdeaBlade.EntityModel.EntityGroup.AddQueriedEntity(EntityWrapper wrapper)
   at IdeaBlade.EntityModel.EntityGroup.LoadEntity(EntityWrapper sourceWrapper, MergeStrategy mergeStrategy, Boolean& rowUpdated)
   at IdeaBlade.EntityModel.EntityMerger.MergeEntityCore(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup)
   at IdeaBlade.EntityModel.EntityMerger.MergeEntity(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup, NavigationContext context)
   at IdeaBlade.EntityModel.EntityMerger.<>c__DisplayClass1.<MergeEntities>b__0(EntityWrapper sourceWrapper)
   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
   at IdeaBlade.EntityModel.DataBlockFns.MakeResultList(Type type, IEnumerable items, Boolean isOrdered)
   at IdeaBlade.EntityModel.EntityQueryResult.UpdateDataSet(EntitiesDataBlock block, NavigationContext context)
   at IdeaBlade.EntityModel.EntitiesDataBlock.Resolve(EntityQueryResult helper)
   at IdeaBlade.EntityModel.EntityQueryResult..ctor(DataQueryResult dataQueryResult, EntityManager entityManager, MergeStrategy mergeStrategy, Guid queryId, QueryInfo queryInfo)
   at IdeaBlade.EntityModel.EntityQueryResultCollection..ctor(DataQueryResultCollection dqResults, EntityManager entityManager, MergeStrategy mergeStrategy)
   at IdeaBlade.EntityModel.EntityManager.MergeAndReturnUsingCache(IEntityFinder finder, DataQueryResultCollection dqResults)
   at IdeaBlade.EntityModel.EntityManager.ProcessFetchedData(DataQueryResultCollection dqResults, IEntityFinder finder)
   at IdeaBlade.EntityModel.EntityManager.AsyncFetchCompleted(AsyncEventArgs args)
   at IdeaBlade.EntityModel.EntityManager.<ExecuteQueryAsyncCore>b__57[T](EntityQueryOperation`1 op)
   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)}
    [System.IndexOutOfRangeException]: {System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at IdeaBlade.EntityModel.Entity.GetValueRaw(DataEntityProperty property, EntityVersion version)
   at IdeaBlade.EntityModel.EntityWrapper.GetValueRaw(DataEntityProperty property)
   at IdeaBlade.EntityModel.EntityWrapper.<GetValuesRaw>b__9(DataEntityProperty p)
   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at IdeaBlade.EntityModel.EntityWrapper.GetValuesRaw(IEnumerable`1 properties)
   at IdeaBlade.EntityModel.EntityWrapper.FindRelatedWrappers(EntityRelationLink relationLink, Boolean includeDeleted)
   at IdeaBlade.EntityModel.EntityWrapper.FindRelatedWrapper(EntityRelationLink relationLink, Boolean includeDeleted)
   at IdeaBlade.EntityModel.ScalarEntityReference`1.FindToEntity()
   at IdeaBlade.EntityModel.ScalarEntityReference`1.FixupReferences()
   at IdeaBlade.EntityModel.EntityWrapper.<FixupReferences>b__13(EntityReferenceBase eref)
   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
   at IdeaBlade.EntityModel.EntityWrapper.FixupReferences()
   at IdeaBlade.EntityModel.EntityWrapper.TrackChanged(EntityChangedEventArgs e)
   at IdeaBlade.EntityModel.EntityGroup.OnEntityChanged(EntityChangedEventArgs e)
   at IdeaBlade.EntityModel.EntityGroup.AddQueriedEntity(EntityWrapper wrapper)
   at IdeaBlade.EntityModel.EntityGroup.LoadEntity(EntityWrapper sourceWrapper, MergeStrategy mergeStrategy, Boolean& rowUpdated)
   at IdeaBlade.EntityModel.EntityMerger.MergeEntityCore(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup)
   at IdeaBlade.EntityModel.EntityMerger.MergeEntity(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup, NavigationContext context)
   at IdeaBlade.EntityModel.EntityMerger.<>c__DisplayClass1.<MergeEntities>b__0(EntityWrapper sourceWrapper)
   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
   at IdeaBlade.EntityModel.DataBlockFns.MakeResultList(Type type, IEnumerable items, Boolean isOrdered)
   at IdeaBlade.EntityModel.EntityQueryResult.UpdateDataSet(EntitiesDataBlock block, NavigationContext context)
   at IdeaBlade.EntityModel.EntitiesDataBlock.Resolve(EntityQueryResult helper)
   at IdeaBlade.EntityModel.EntityQueryResult..ctor(DataQueryResult dataQueryResult, EntityManager entityManager, MergeStrategy mergeStrategy, Guid queryId, QueryInfo queryInfo)
   at IdeaBlade.EntityModel.EntityQueryResultCollection..ctor(DataQueryResultCollection dqResults, EntityManager entityManager, MergeStrategy mergeStrategy)
   at IdeaBlade.EntityModel.EntityManager.MergeAndReturnUsingCache(IEntityFinder finder, DataQueryResultCollection dqResults)
   at IdeaBlade.EntityModel.EntityManager.ProcessFetchedData(DataQueryResultCollection dqResults, IEntityFinder finder)
   at IdeaBlade.EntityModel.EntityManager.AsyncFetchCompleted(AsyncEventArgs args)
   at IdeaBlade.EntityModel.EntityManager.<ExecuteQueryAsyncCore>b__57[T](EntityQueryOperation`1 op)
   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)}
    Data: {System.Collections.ListDictionaryInternal}
    InnerException: null
    Message: "Index was outside the bounds of the array."
    StackTrace: "   at IdeaBlade.EntityModel.Entity.GetValueRaw(DataEntityProperty property, EntityVersion version)\r\n   at IdeaBlade.EntityModel.EntityWrapper.GetValueRaw(DataEntityProperty property)\r\n   at IdeaBlade.EntityModel.EntityWrapper.<GetValuesRaw>b__9(DataEntityProperty p)\r\n   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)\r\n   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()\r\n   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n   at IdeaBlade.EntityModel.EntityWrapper.GetValuesRaw(IEnumerable`1 properties)\r\n   at IdeaBlade.EntityModel.EntityWrapper.FindRelatedWrappers(EntityRelationLink relationLink, Boolean includeDeleted)\r\n   at IdeaBlade.EntityModel.EntityWrapper.FindRelatedWrapper(EntityRelationLink relationLink, Boolean includeDeleted)\r\n   at IdeaBlade.EntityModel.ScalarEntityReference`1.FindToEntity()\r\n   at IdeaBlade.EntityModel.ScalarEntityReference
`1.FixupReferences()\r\n   at IdeaBlade.EntityModel.EntityWrapper.<FixupReferences>b__13(EntityReferenceBase eref)\r\n   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)\r\n   at IdeaBlade.EntityModel.EntityWrapper.FixupReferences()\r\n   at IdeaBlade.EntityModel.EntityWrapper.TrackChanged(EntityChangedEventArgs e)\r\n   at IdeaBlade.EntityModel.EntityGroup.OnEntityChanged(EntityChangedEventArgs e)\r\n   at IdeaBlade.EntityModel.EntityGroup.AddQueriedEntity(EntityWrapper wrapper)\r\n   at IdeaBlade.EntityModel.EntityGroup.LoadEntity(EntityWrapper sourceWrapper, MergeStrategy mergeStrategy, Boolean& rowUpdated)\r\n   at IdeaBlade.EntityModel.EntityMerger.MergeEntityCore(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup)\r\n   at IdeaBlade.EntityModel.EntityMerger.MergeEntity(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup, NavigationContext context)\r\n   at IdeaBlade.EntityModel.EntityMerger.<>c__DisplayClass1.<MergeEntities>b__0(EntityWrapper sourceWrapper)\
r\n   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)\r\n   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)\r\n   at IdeaBlade.EntityModel.DataBlockFns.MakeResultList(Type type, IEnumerable items, Boolean isOrdered)\r\n   at IdeaBlade.EntityModel.EntityQueryResult.UpdateDataSet(EntitiesDataBlock block, NavigationContext context)\r\n   at IdeaBlade.EntityModel.EntitiesDataBlock.Resolve(EntityQueryResult helper)\r\n   at IdeaBlade.EntityModel.EntityQueryResult..ctor(DataQueryResult dataQueryResult, EntityManager entityManager, MergeStrategy mergeStrategy, Guid queryId, QueryInfo queryInfo)\r\n   at IdeaBlade.EntityModel.EntityQueryResultCollection..ctor(DataQueryResultCollection dqResults, EntityManager entityManager, MergeStrategy mergeStrategy)\r\n   at IdeaBlade.EntityModel.EntityManager.MergeAndReturnUsingCache(IEntityFinder finder, DataQueryResultCollection dqResults
)\r\n   at IdeaBlade.EntityModel.EntityManager.ProcessFetchedData(DataQueryResultCollection dqResults, IEntityFinder finder)\r\n   at IdeaBlade.EntityModel.EntityManager.AsyncFetchCompleted(AsyncEventArgs args)\r\n   at IdeaBlade.EntityModel.EntityManager.<ExecuteQueryAsyncCore>b__57[T](EntityQueryOperation`1 op)\r\n   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)"




Replies:
Posted By: ting
Date Posted: 17-Aug-2010 at 7:00pm

Can you check that this works with the raw Entity Framework?  There are a few Linq2SQL statements that don't work with Linq2Entities.



Posted By: jsobell
Date Posted: 17-Aug-2010 at 11:14pm
I can confirm that swapping out DF for EF4 gives no error message.
I'll email you a sample project showing the error.




Print Page | Close Window