private PropagatorResult CreateSimpleResult( IEntityStateEntry stateEntry, IExtendedDataRecord record, ExtractorMetadata.MemberInformation memberInformation, int identifier, bool isModified, int recordOrdinal, object value) { CurrentValueRecord record1 = record as CurrentValueRecord; PropagatorFlags flags = memberInformation.Flags; if (!isModified) { flags |= PropagatorFlags.Preserve; } if (-1 != identifier) { PropagatorResult owner = !memberInformation.IsServerGenerated && !memberInformation.IsForeignKeyMember || record1 == null?PropagatorResult.CreateKeyValue(flags, value, stateEntry, identifier) : PropagatorResult.CreateServerGenKeyValue(flags, value, stateEntry, identifier, recordOrdinal); this.m_translator.KeyManager.RegisterIdentifierOwner(owner); return(owner); } if ((memberInformation.IsServerGenerated || memberInformation.IsForeignKeyMember) && record1 != null) { return(PropagatorResult.CreateServerGenSimpleValue(flags, value, record1, recordOrdinal)); } return(PropagatorResult.CreateSimpleValue(flags, value)); }
private PropagatorResult CreateEntityKeyResult( IEntityStateEntry stateEntry, EntityKey entityKey) { RowType keyRowType = entityKey.GetEntitySet(this.m_translator.MetadataWorkspace).ElementType.GetKeyRowType(); ExtractorMetadata extractorMetadata = this.m_translator.GetExtractorMetadata(stateEntry.EntitySet, (StructuralType)keyRowType); PropagatorResult[] values = new PropagatorResult[keyRowType.Properties.Count]; for (int memberOffset = 0; memberOffset < keyRowType.Properties.Count; ++memberOffset) { EdmMember property = (EdmMember)keyRowType.Properties[memberOffset]; ExtractorMetadata.MemberInformation member = extractorMetadata.m_memberMap[memberOffset]; int identifierForMemberOffset = this.m_translator.KeyManager.GetKeyIdentifierForMemberOffset(entityKey, memberOffset, keyRowType.Properties.Count); object obj = !entityKey.IsTemporary ? entityKey.FindValueByName(property.Name) : stateEntry.StateManager.GetEntityStateEntry(entityKey).CurrentValues[property.Name]; values[memberOffset] = PropagatorResult.CreateKeyValue(member.Flags, obj, stateEntry, identifierForMemberOffset); } return(PropagatorResult.CreateStructuralValue(values, extractorMetadata.m_type, false)); }
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)); }