Print Page | Close Window

Using EntityServerSaveInterceptor with CF

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=3608
Printed Date: 25-Oct-2025 at 11:13pm


Topic: Using EntityServerSaveInterceptor with CF
Posted By: jradxl
Subject: Using EntityServerSaveInterceptor with CF
Date Posted: 04-Sep-2012 at 4:17pm
When trying to use an EntityServerSaveInterceptor with Code First I'm getting a "Collection was modified; enumeration operation may not execute" error.

Is it obvious what I'm doing wrong?

thanks
        protected override bool ExecuteSave()
        {
            var em = this.EntityManager;
            var entities = em.FindEntities(EntityState.Added | EntityState.Modified | EntityState.Deleted);
            foreach (IEntity entity in entities)
            {




Replies:
Posted By: jradxl
Date Posted: 05-Sep-2012 at 3:43am
Sorry, it was late..
I was adding a new entity for auditing and was refactoring some code and forgot why I did it that way originally.
Now I just put them in a collection and addEntities() later outside loop.
Thanks





Print Page | Close Window