Print Page | Close Window

An Editing Session (IEditableObject)

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=2835
Printed Date: 09-Jun-2026 at 10:19pm


Topic: An Editing Session (IEditableObject)
Posted By: vbivona
Subject: An Editing Session (IEditableObject)
Date Posted: 18-Jul-2011 at 1:01pm
I'm looking for a way to find out whether an editing session for an entity is open (if BeginEdit has been called)? I looked at EntityAspect and EntityState and didn't see anything. It looks like I can override Entity.BeginEditCore, Entity.EndEditCore and Entity.CancelEditCore to implement something if needed.



Replies:
Posted By: robertg
Date Posted: 21-Jul-2011 at 9:58am

You could always check to see if EntityVersion.Default is the same as  EntityVersion.Proposed; until an editing session is started, it will instead be mapped to EntityVersion.Current. It might be easier to implement a new property as you've suggested, though, since it gives you one clear place to check.

Yours,
Robert


Posted By: robertg
Date Posted: 21-Jul-2011 at 10:21am
Actually, I've just realized that if you ask for EntityVersion.Proposed, when it hasn't been defined by starting an edit, you'll get EntityVersion.Default (which in that case will be EntityVersion.Current). Checking this clearly won't work, you'll have to implement what you suggested.
 
Sorry for the wrong information. It made sense, but it didn't seem to be working correctly when I tried it out, and when I checked teh documentation, I saw that I'd forgotten how EntityVersion handles undefined versions.
 
Yours,
Robert


Posted By: vbivona
Date Posted: 22-Jul-2011 at 4:36pm
OK. Thanks very much, I'll set a flag in my object.



Print Page | Close Window