QuoteReplyTopic: Error: During save of a many-to-many relationship "Sequence contains no matching element " Posted: 13-Nov-2012 at 11:29am
I have a many-to-many relationship defined with a join table that uses Foreign Key association, and there is no payload.
When I add a secondary object to the first object's navigation property, all is fine (both navigation property RelatedEntityLists are populated as they should be), until I try to save.
System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate) at IdeaBlade.EntityModel.Edm.EdmSaveExecutor.ProcessManyToMany(List`1 entities) at IdeaBlade.EntityModel.Edm.EdmSaveExecutor.ProcessSaves(IEnumerable`1 groupsByType) at IdeaBlade.EntityModel.Edm.EdmSaveExecutor.SaveWithinContext() at IdeaBlade.EntityModel.Edm.EdmSaveExecutor.Save(DataSourceResolver dataSourceResolver, IDataSourceKey dsKey, SaveWorkState workState)
They only thing I'm doing differently here is I'm doing a linq query (based on information outside of the model) to determine which secondary object to add to the collection.
var q = from r in CurrentUser.Rights join d in ((Scheduler.SchedulerEntities)result.EntityAspect.EntityManager).Divisions on r.RightName equals d.Name select d;
foreach (Division division in q) { if (division != null) result.Divisions.Add(division); }
Our project is large and reducing it to a manageable size is quite an undertaking. We are a small team and under a crunch at the moment getting a release out; in the meantime I have worked around this issue. After the release I will have time to work this out.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum