// // RelationshipEntry // public static bool IsRelationshipForKey(this ObjectStateEntry entry, EntityKey key) { if (entry.IsRelationship == false) { return(false); } return(((EntityKey)entry.UsableValues()[0] == key) || ((EntityKey)entry.UsableValues()[1] == key)); }
public static EntityKey OtherEndKey(this ObjectStateEntry relationshipEntry, EntityKey thisEndKey) { Debug.Assert(relationshipEntry.IsRelationship); Debug.Assert(thisEndKey != (EntityKey)null); if ((EntityKey)((IDataRecord)relationshipEntry.UsableValues())[0] == thisEndKey) { return((EntityKey)((IDataRecord)relationshipEntry.UsableValues())[1]); } if ((EntityKey)((IDataRecord)relationshipEntry.UsableValues())[1] == thisEndKey) { return((EntityKey)((IDataRecord)relationshipEntry.UsableValues())[0]); } throw new InvalidOperationException("Neither end of the relationship contains the passed in key."); }
public static bool IsRelationshipForKey(this ObjectStateEntry entry, EntityKey key) { if (!entry.IsRelationship) { return(false); } return((EntityKey)((IDataRecord)entry.UsableValues())[0] == key || (EntityKey)((IDataRecord)entry.UsableValues())[1] == key); }
public static string OtherEndRole(this ObjectStateEntry relationshipEntry, EntityKey thisEndKey) { Debug.Assert(relationshipEntry != null); Debug.Assert(relationshipEntry.IsRelationship); Debug.Assert(thisEndKey != null); if ((EntityKey)relationshipEntry.UsableValues()[0] == thisEndKey) { return(relationshipEntry.UsableValues().DataRecordInfo.FieldMetadata[1].FieldType.Name); } else if ((EntityKey)relationshipEntry.UsableValues()[1] == thisEndKey) { return(relationshipEntry.UsableValues().DataRecordInfo.FieldMetadata[0].FieldType.Name); } else { throw new InvalidOperationException("Neither end of the relationship contains the passed in key."); } }
public static EdmType EdmType(this ObjectStateEntry entry) { return(entry.UsableValues().DataRecordInfo.RecordType.EdmType); }