New Posts New Posts RSS Feed: EntityServerSaveInterceptor
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EntityServerSaveInterceptor

 Post Reply Post Reply
Author
Vincent View Drop Down
Newbie
Newbie


Joined: 21-May-2010
Location: Tanzania
Posts: 22
Post Options Post Options   Quote Vincent Quote  Post ReplyReply Direct Link To This Post Topic: EntityServerSaveInterceptor
    Posted: 15-Nov-2011 at 2:12am
Hi Everybody
 
Can anyone give me a sample code on how to get both old and new property values of an entity that has been modified by implementing EntityServerSaveInterceptor on the server side?
 
 
Best Regards,
Vincent
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 15-Nov-2011 at 8:54am
Hello Vincent,
 
Here is a litle example :
 
    class MyEntityServerSaveManager : EntityServerSaveInterceptor  
    {
        protected override bool ExecuteSave()
        {
 
            foreach (var entity in EntityManager.FindEntities(EntityState.Modified).OfType<MyEntity>())
            {
                var oldValue = (string)EntityAspect.Wrap(entity).GetValue("MyStringProperty", EntityVersion.Original);
                var newValue = entity.MyStringProperty;
                if (oldValue != newValue)
                {
                //...
                }

            }
            
            return base.ExecuteSave();
        }
 
    }
Back to Top
Vincent View Drop Down
Newbie
Newbie


Joined: 21-May-2010
Location: Tanzania
Posts: 22
Post Options Post Options   Quote Vincent Quote  Post ReplyReply Direct Link To This Post Posted: 23-Nov-2011 at 7:45pm
Hi Walid
 
Thank you for the help. I have implemented it and it has worked.
 
Best Regards,
Vincent
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down