Can you please explain to me why the following code doesn't work?
(ObjectState state = AppRegistryDataContext.PersistenceState.GetState(Model);
if (state.HasFlag(ObjectState.Clean) ||
//attach the object in order to persist the changes.
Upon debugging, GetState returns a value of 60. But, based on the values of the ObjectState enum, Clean and Dirty both return true so the AttachCopy gets called and returns the error referenced in the start of this thread.
Were these combination values set that way on purpose or was it a mistake? I ask because the values appear to be correct up until the value for NotLoaded (48), but then they go into combination values like Clean which is 56 (111000 in binary) which means that if Clean is set, so are NotLoaded (48), MaskNoMask (32), MaskManaged (16), and MaskLoaded(8). In my case, the value is 60 so that means that MaskNoMask, MaskManaged, MaskLoaded, and MaskDirty are all set. The problem is, of course, that Clean and Dirty also return true on a bitwise check because their values line up in binary because these are incorrect Flags values unless it was intended that way and if it was intended that way, then there are other issues with your OpenAccess code.