private PropagatorResult ConvertStateEntryToPropagatorResult( IEntityStateEntry stateEntry, bool useCurrentValues, ModifiedPropertiesBehavior modifiedPropertiesBehavior) { try { IExtendedDataRecord record = useCurrentValues ? (IExtendedDataRecord)stateEntry.CurrentValues : (IExtendedDataRecord)stateEntry.OriginalValues; bool isModified = false; return(ExtractorMetadata.ExtractResultFromRecord(stateEntry, isModified, record, useCurrentValues, this.m_updateTranslator, modifiedPropertiesBehavior)); } catch (Exception ex) { if (ex.RequiresContext()) { throw EntityUtil.Update(Strings.Update_ErrorLoadingRecord, ex, stateEntry); } throw; } }
private PropagatorResult ConvertStateEntryToPropagatorResult( IEntityStateEntry stateEntry, bool useCurrentValues, ModifiedPropertiesBehavior modifiedPropertiesBehavior) { DebugCheck.NotNull(stateEntry); try { var record = useCurrentValues ? stateEntry.CurrentValues : (IExtendedDataRecord)stateEntry.OriginalValues; var isModified = false; // the root of the state entry is unchanged because the type is static return(ExtractorMetadata.ExtractResultFromRecord( stateEntry, isModified, record, useCurrentValues, m_updateTranslator, modifiedPropertiesBehavior)); } catch (Exception e) { if (e.RequiresContext()) { throw EntityUtil.Update(Strings.Update_ErrorLoadingRecord, e, stateEntry); } throw; } }
internal PropagatorResult RetrieveMember( IEntityStateEntry stateEntry, IExtendedDataRecord record, bool useCurrentValues, EntityKey key, int ordinal, ModifiedPropertiesBehavior modifiedPropertiesBehavior) { ExtractorMetadata.MemberInformation member = this.m_memberMap[ordinal]; int identifier; if (member.IsKeyMember) { int memberOffset = member.EntityKeyOrdinal.Value; identifier = this.m_translator.KeyManager.GetKeyIdentifierForMemberOffset(key, memberOffset, ((EntityTypeBase)this.m_type).KeyMembers.Count); } else { identifier = !member.IsForeignKeyMember ? -1 : this.m_translator.KeyManager.GetKeyIdentifierForMember(key, record.GetName(ordinal), useCurrentValues); } int num; switch (modifiedPropertiesBehavior) { case ModifiedPropertiesBehavior.AllModified: num = 1; break; case ModifiedPropertiesBehavior.SomeModified: if (stateEntry.ModifiedProperties != null) { num = stateEntry.ModifiedProperties[member.Ordinal] ? 1 : 0; break; } goto default; default: num = 0; break; } bool isModified = num != 0; if (member.CheckIsNotNull && record.IsDBNull(ordinal)) { throw EntityUtil.Update(Strings.Update_NullValue((object)record.GetName(ordinal)), (Exception)null, stateEntry); } object obj = record.GetValue(ordinal); EntityKey entityKey = obj as EntityKey; if ((object)entityKey != null) { return(this.CreateEntityKeyResult(stateEntry, entityKey)); } IExtendedDataRecord record1 = obj as IExtendedDataRecord; if (record1 == null) { return(this.CreateSimpleResult(stateEntry, record, member, identifier, isModified, ordinal, obj)); } ModifiedPropertiesBehavior modifiedPropertiesBehavior1 = isModified ? ModifiedPropertiesBehavior.AllModified : ModifiedPropertiesBehavior.NoneModified; UpdateTranslator translator = this.m_translator; return(ExtractorMetadata.ExtractResultFromRecord(stateEntry, isModified, record1, useCurrentValues, translator, modifiedPropertiesBehavior1)); }